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 <thiago.macieira@intel.com>
bb10
Kai Koehne 2014-08-28 15:22:35 +02:00 committed by Oswald Buddenhagen
parent d4d752e241
commit 0fa0608f70
1 changed files with 3 additions and 6 deletions

View File

@ -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)
{