diff options
author | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-02-13 14:37:05 +0100 |
---|---|---|
committer | Tor Arne Vestbø <tor.arne.vestbo@qt.io> | 2018-02-14 14:18:09 +0000 |
commit | 54d57cbd6fe9c6f668bb42f02f2674239359e6fd (patch) | |
tree | 945f2af28123320f63998f56a560d2af44c1b329 /src/corelib/thread/qthread_win.cpp | |
parent | fe5edcee602f0ab2912bbdd1a21f4309ed7dbfd6 (diff) |
Make QThreadPrivate::createEventDispatcher do exactly what it says
Leaving the logic of starting up the event dispatcher to the call site,
unified both the case of a custom event dispatcher and the default
event dispatcher.
The data argument is left in due to the static nature of the function.
Change-Id: Ia2020e39ccc67cd5a583d4e614dd978b2ec44dba
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/thread/qthread_win.cpp')
-rw-r--r-- | src/corelib/thread/qthread_win.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 136733444c..4459ae87af 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -331,15 +331,14 @@ void qt_set_thread_name(HANDLE threadId, LPCSTR threadName) #endif // QT_NO_THREAD -void QThreadPrivate::createEventDispatcher(QThreadData *data) +QAbstractEventDispatcher *QThreadPrivate::createEventDispatcher(QThreadData *data) { + Q_UNUSED(data); #ifndef Q_OS_WINRT - QEventDispatcherWin32 *theEventDispatcher = new QEventDispatcherWin32; + return new QEventDispatcherWin32; #else - QEventDispatcherWinRT *theEventDispatcher = new QEventDispatcherWinRT; + return new QEventDispatcherWinRT; #endif - data->eventDispatcher.storeRelease(theEventDispatcher); - theEventDispatcher->startingUp(); } #ifndef QT_NO_THREAD @@ -360,10 +359,13 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi data->quitNow = thr->d_func()->exited; } - if (data->hasEventDispatcher()) // custom event dispatcher set? - data->eventDispatcher.load()->startingUp(); - else - createEventDispatcher(data); + QAbstractEventDispatcher *eventDispatcher = data->eventDispatcher.load(); + if (!eventDispatcher) { + eventDispatcher = createEventDispatcher(data); + data->eventDispatcher.storeRelease(eventDispatcher); + } + + eventDispatcher->startingUp(); #if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC) && !defined(Q_OS_WINRT) // sets the name of the current thread. |