refs #336 Fixed CLogHandler thread safety in swiftcore.

This commit is contained in:
Mathew Sutcliffe
2014-10-16 16:36:53 +01:00
parent d0894d2cf9
commit c30bf9f61e
4 changed files with 33 additions and 13 deletions

View File

@@ -45,10 +45,6 @@ namespace BlackMisc
//! \warning This must only be called from the main thread.
CLogCategoryHandler *handlerForCategoryPrefix(const QString &prefix);
//! Enable or disable the default Qt handler.
//! \warning This must only be called from the main thread.
void enableConsoleOutput(bool enable);
signals:
//! Emitted when a message is logged in this process.
void localMessageLogged(const BlackMisc::CStatusMessage &message);
@@ -63,6 +59,9 @@ namespace BlackMisc
//! Called by the context to relay a message.
void logRemoteMessage(const BlackMisc::CStatusMessage &message);
//! Enable or disable the default Qt handler.
void enableConsoleOutput(bool enable);
private:
void logMessage(const BlackMisc::CStatusMessage &message);
QtMessageHandler m_oldHandler = nullptr;
@@ -80,11 +79,10 @@ namespace BlackMisc
{
Q_OBJECT
public:
public slots:
/*!
* Enable or disable the default Qt handler for messages in relevant categories.
* This can override the setting of the parent CLogHandler.
* \warning This must only be called from the main thread.
*/
void enableConsoleOutput(bool enable) { Q_ASSERT(thread() == QThread::currentThread()); m_enableFallThrough = enable; }