summaryrefslogtreecommitdiffstats
path: root/src/corelib/kernel/qcoreapplication.cpp
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-02-13 17:11:50 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2018-02-15 14:00:21 +0000
commit6c4f5ecef0c9bc8bfb31ef4099d53ba02f0611aa (patch)
tree0a7d94638f03ad025e93da0cf2faa50e0224029f /src/corelib/kernel/qcoreapplication.cpp
parentea21b36836abd6c2bb6d139c9d4b8149acdc4785 (diff)
Share event dispatcher creation between QThreadPrivate and QCoreApplication
A step towards having the application do its event dispatching though the thread data's dispatcher, like QEventLoop, instead of keeping two references to the same dispatcher, one in QCoreApplicationPrivate and one in QThreadData. Change-Id: I7b215e7e99869d25638ec67f0666f632a508cc0f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/kernel/qcoreapplication.cpp')
-rw-r--r--src/corelib/kernel/qcoreapplication.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index ef431baca6..4e32f90964 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -538,29 +538,10 @@ void QCoreApplicationPrivate::cleanupThreadData()
void QCoreApplicationPrivate::createEventDispatcher()
{
Q_Q(QCoreApplication);
-#if defined(Q_OS_UNIX)
-# if defined(Q_OS_DARWIN)
- bool ok = false;
- int value = qEnvironmentVariableIntValue("QT_EVENT_DISPATCHER_CORE_FOUNDATION", &ok);
- if (ok && value > 0)
- eventDispatcher = new QEventDispatcherCoreFoundation(q);
- else
- eventDispatcher = new QEventDispatcherUNIX(q);
-# elif !defined(QT_NO_GLIB)
- if (qEnvironmentVariableIsEmpty("QT_NO_GLIB") && QEventDispatcherGlib::versionSupported())
- eventDispatcher = new QEventDispatcherGlib(q);
- else
- eventDispatcher = new QEventDispatcherUNIX(q);
-# else
- eventDispatcher = new QEventDispatcherUNIX(q);
-# endif
-#elif defined(Q_OS_WINRT)
- eventDispatcher = new QEventDispatcherWinRT(q);
-#elif defined(Q_OS_WIN)
- eventDispatcher = new QEventDispatcherWin32(q);
-#else
-# error "QEventDispatcher not yet ported to this platform"
-#endif
+ QThreadData *data = QThreadData::current();
+ Q_ASSERT(!data->hasEventDispatcher());
+ eventDispatcher = QThreadPrivate::createEventDispatcher(data);
+ eventDispatcher->setParent(q);
}
void QCoreApplicationPrivate::eventDispatcherReady()