From 894ce8aaab8d3319a704deb73cb5109d092df0aa Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 13 Jan 2014 14:19:49 +0100 Subject: 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 --- src/corelib/kernel/qobject.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/corelib/kernel/qobject.cpp') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index f1351f5a077..5819443d3cb 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; } -- cgit v1.2.3 From 9132dbb6592c3357585d5c589b48d814497f1cc5 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Thu, 16 Jan 2014 11:31:51 +0100 Subject: Do not consider a signal to be connected if only a signal spy is installed. This fixes QtQuick key handling not propagating key events beyond the specific onXPressed handlers, due to erroneously thinking those exist, when signal spy callbacks are present. Considering signal spies for isSignalConnected() goes back to 87239ef6 in Qt4, and seems to be there just due to this code being based on activate(), where this check obviously makes sense. Change-Id: Iad41e42a8d3ee2a16a55be7d1a7cdc51484981ce Reviewed-by: Olivier Goffart --- src/corelib/kernel/qobject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib/kernel/qobject.cpp') diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 5819443d3cb..43b88d21b50 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -3453,8 +3453,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i { int signal_index = signalOffset + local_signal_index; - if (!sender->d_func()->isSignalConnected(signal_index)) + if (!sender->d_func()->isSignalConnected(signal_index) + && !qt_signal_spy_callback_set.signal_begin_callback + && !qt_signal_spy_callback_set.signal_end_callback) { return; // nothing connected to these signals, and no spy + } if (sender->d_func()->blockSig) return; -- cgit v1.2.3