From 0fa0608f707306cb34a9ca91952cebbac25065a5 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 28 Aug 2014 15:22:35 +0200 Subject: Logging: Remove use of _declspec(thread) thread-local variables are known to be broken on Windows XP if the library is loaded dynamically. This has been fixed since Windows Vista, but to avoid any elaborate runtime checking of the OS version we're just removing the logic alltogether for MSVC / Windows. Task-number: QTBUG-41008 Change-Id: I64ee95270d142294c975a5890d6e1b62a833b6ef Reviewed-by: Thiago Macieira --- src/corelib/global/qlogging.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index ca0fb1bb23..51169eb963 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -1282,12 +1282,9 @@ static void qDefaultMsgHandler(QtMsgType type, const char *buf) qDefaultMessageHandler(type, emptyContext, QString::fromLocal8Bit(buf)); } -#if defined(Q_COMPILER_THREAD_LOCAL) || (defined(Q_CC_MSVC) && !defined(Q_OS_WINCE)) -#if defined(Q_CC_MSVC) -static __declspec(thread) bool msgHandlerGrabbed = false; -#else +#if defined(Q_COMPILER_THREAD_LOCAL) + static thread_local bool msgHandlerGrabbed = false; -#endif static bool grabMessageHandler() { @@ -1306,7 +1303,7 @@ static void ungrabMessageHandler() #else static bool grabMessageHandler() { return true; } static void ungrabMessageHandler() { } -#endif // (Q_COMPILER_THREAD_LOCAL) || ((Q_CC_MSVC) && !(Q_OS_WINCE)) +#endif // (Q_COMPILER_THREAD_LOCAL) static void qt_message_print(QtMsgType msgType, const QMessageLogContext &context, const QString &message) { -- cgit v1.2.3