Call QEventDispatcher::startingUp() on thread start
...instead of during createEventDispatcher(). This way, startingUp() will be called [on the thread being started] also for custom event dispatchers installed with QThread::setEventDispatcher(). This prevents crashes when installing event dispatches which expects that startingUp() will be called. Crash reproducible with test case from QTBUG-51961. Change-Id: I71bd696539689d928a61ff9b47d05297cf803b2f Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
cd6d805d93
commit
b3b95670b2
@ -125,7 +125,6 @@ QAbstractEventDispatcher *QThreadData::createEventDispatcher()
|
||||
{
|
||||
QAbstractEventDispatcher *ed = QThreadPrivate::createEventDispatcher(this);
|
||||
eventDispatcher.storeRelease(ed);
|
||||
ed->startingUp();
|
||||
return ed;
|
||||
}
|
||||
|
||||
|
@ -308,6 +308,7 @@ void *QThreadPrivate::start(void *arg)
|
||||
}
|
||||
|
||||
data->ensureEventDispatcher();
|
||||
data->eventDispatcher.loadRelaxed()->startingUp();
|
||||
|
||||
#if (defined(Q_OS_LINUX) || defined(Q_OS_MAC) || defined(Q_OS_QNX))
|
||||
{
|
||||
|
@ -312,6 +312,7 @@ unsigned int __stdcall QT_ENSURE_STACK_ALIGNED_FOR_SSE QThreadPrivate::start(voi
|
||||
}
|
||||
|
||||
data->ensureEventDispatcher();
|
||||
data->eventDispatcher.loadRelaxed()->startingUp();
|
||||
|
||||
#if !defined(QT_NO_DEBUG) && defined(Q_CC_MSVC)
|
||||
// sets the name of the current thread.
|
||||
|
Loading…
Reference in New Issue
Block a user