summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>2014-01-13 14:19:49 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-01-16 15:41:21 +0100
commit894ce8aaab8d3319a704deb73cb5109d092df0aa (patch)
treee31abf7ddf41be853631958c12b13560d7e223e3 /src/corelib/kernel
parentaa7ec3cdf5d423b7abb7d0bb5ff7772602d41962 (diff)
Android: Don't register main thread on loading library
When building with debug, all SLOT or SIGNAL macros will expand to a function call, and then function will call QThreadData::current(), which will set QCoreApplication::theMainThread if it has not already been done. Since Qt Widgets has these macros in the static initialization of the library, we would register the Android main thread as the main thread of Qt, which would mean that the actual application object was created on a different thread than the main thread. This caused warnings to appear, and also triggered a race condition which caused widget applications to sometimes show a black screen instead of content on startup when run with the OpenGL plugin. Task-number: QTBUG-35048 Change-Id: Ie8979f5e7cd5662f8d7dd276de9f94f27cc120b5 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r--src/corelib/kernel/qobject.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index f1351f5a07..5819443d3c 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2086,7 +2086,9 @@ void QObject::deleteLater()
const char *qFlagLocation(const char *method)
{
- QThreadData::current()->flaggedSignatures.store(method);
+ QThreadData *currentThreadData = QThreadData::current(false);
+ if (currentThreadData != 0)
+ currentThreadData->flaggedSignatures.store(method);
return method;
}