mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-30 11:55:35 +08:00
Fixed mistakes in CStatusMessage copy assignment operator
This commit is contained in:
@@ -102,21 +102,19 @@ namespace BlackMisc
|
||||
|
||||
CStatusMessage &CStatusMessage::operator =(const CStatusMessage &other)
|
||||
{
|
||||
// locks because of mutable members
|
||||
if (this == &other) { return *this; }
|
||||
|
||||
static_cast<CMessageBase &>(*this) = other;
|
||||
static_cast<ITimestampBased &>(*this) = other;
|
||||
static_cast<IOrderable &>(*this) = other;
|
||||
|
||||
// locks because of mutable member
|
||||
QReadLocker readLock(&other.m_lock);
|
||||
const auto handledBy = other.m_handledByObjects;
|
||||
const qint64 ts = other.m_timestampMSecsSinceEpoch;
|
||||
const int order = other.m_order;
|
||||
readLock.unlock(); // avoid deadlock
|
||||
|
||||
QWriteLocker writeLock(&m_lock);
|
||||
m_handledByObjects = handledBy;
|
||||
m_timestampMSecsSinceEpoch = ts;
|
||||
m_order = order;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -518,7 +518,7 @@ namespace BlackMisc
|
||||
CStatusMessage(const CLogCategoryList &categories, StatusSeverity severity, QStringView message, bool validation);
|
||||
|
||||
mutable QVector<quintptr> m_handledByObjects;
|
||||
mutable QReadWriteLock m_lock; //!< lock (because of mutable members)
|
||||
mutable QReadWriteLock m_lock; //!< lock (because of mutable member)
|
||||
|
||||
//! \fixme KB 2019-01 order and timestamp "disabled" for Ref T184 token bucket. Would it be better to enable those and use a special comparison function for that (e.g. "equalMessageAndSeverity")?
|
||||
BLACK_METACLASS(
|
||||
|
||||
Reference in New Issue
Block a user