summaryrefslogtreecommitdiffstats
path: root/src/network/bearer
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2015-04-16 17:21:37 -0700
committerThiago Macieira <thiago.macieira@intel.com>2015-07-18 02:24:59 +0000
commit10c529b08de7cd55b4c3e3654464119246498273 (patch)
treeb2ebe0a8bc1cef7767817b20cf88cda41d6df6c2 /src/network/bearer
parent9d98584a835962ca7ad870bbede8f6ab7f66b6bf (diff)
Add a way for auxiliary threads to handle events without CoreApp
Long-lived threads started by Qt itself can now receive events even if QCoreApplication hasn't been created. This is required in all threads we start that will handle events, unless we're sure that the thread will exit before the global application object begins destruction. Otherwise, those threads will have race conditions dealing with the event delivery system trying to call the QCoreApplication::notify() virtual while the object is being destroyed. Change-Id: I27eaacb532114dd188c4ffff13d4ad2a4bb443e6 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com>
Diffstat (limited to 'src/network/bearer')
-rw-r--r--src/network/bearer/qnetworkconfigmanager_p.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp
index c1e837de7b..78d4970ca1 100644
--- a/src/network/bearer/qnetworkconfigmanager_p.cpp
+++ b/src/network/bearer/qnetworkconfigmanager_p.cpp
@@ -41,6 +41,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qthread.h>
#include <QtCore/private/qcoreapplication_p.h>
+#include <QtCore/private/qthread_p.h>
#ifndef QT_NO_BEARERMANAGEMENT
@@ -61,7 +62,7 @@ QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate()
void QNetworkConfigurationManagerPrivate::initialize()
{
//Two stage construction, because we only want to do this heavyweight work for the winner of the Q_GLOBAL_STATIC race.
- bearerThread = new QThread();
+ bearerThread = new QDaemonThread();
bearerThread->setObjectName(QStringLiteral("Qt bearer thread"));
bearerThread->moveToThread(QCoreApplicationPrivate::mainThread()); // because cleanup() is called in main thread context.