refs #522, mutex for mutable members (thread safe)

* copy/assignment/lock for mutable members
* also removed redundant in status message (slack discussion MS/KB)
This commit is contained in:
Klaus Basan
2015-11-26 02:31:13 +01:00
parent a4ba45ce75
commit d6733d49bb
13 changed files with 115 additions and 73 deletions

View File

@@ -0,0 +1,30 @@
/* Copyright (C) 2015
* swift project Community / Contributors
*
* This file is part of Swift Project. It is subject to the license terms in the LICENSE file found in the top-level
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
* including this file, may be copied, modified, propagated, or distributed except according to the terms
* contained in the LICENSE file.
*/
#include "statusexception.h"
namespace BlackMisc
{
CStatusException::CStatusException(const CStatusMessage &payload) :
m_payload(payload)
{}
CStatusException::CStatusException(const CStatusException &other) : std::exception(other)
{
QReadLocker lock(&other.m_lock);
this->m_temp = other.m_temp;
}
const char *CStatusException::what() const Q_DECL_NOEXCEPT
{
QWriteLocker lock(&this->m_lock);
if (m_temp.isNull()) { m_temp = m_payload.getMessage().toLocal8Bit(); }
return m_temp;
}
} // ns