QBasicTimer: release timer id on exit
In some cases of inheritance, timer deletion can be triggered from the event dispatcher destructor where QThreadData::eventDispatcher is already nullptr. Despite the fact that the application is in shutdown phase, we should free the resource. Change-Id: I61ed1d817fd7638953f7d629823f19d4f6f1ee00 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>bb10
parent
38f38c7188
commit
79a1fc0e01
|
|
@ -216,13 +216,11 @@ void QBasicTimer::stop()
|
|||
{
|
||||
if (id) {
|
||||
QAbstractEventDispatcher *eventDispatcher = QAbstractEventDispatcher::instance();
|
||||
if (eventDispatcher) {
|
||||
if (Q_UNLIKELY(!eventDispatcher->unregisterTimer(id))) {
|
||||
qWarning("QBasicTimer::stop: Failed. Possibly trying to stop from a different thread");
|
||||
return;
|
||||
}
|
||||
QAbstractEventDispatcherPrivate::releaseTimerId(id);
|
||||
if (eventDispatcher && !eventDispatcher->unregisterTimer(id)) {
|
||||
qWarning("QBasicTimer::stop: Failed. Possibly trying to stop from a different thread");
|
||||
return;
|
||||
}
|
||||
QAbstractEventDispatcherPrivate::releaseTimerId(id);
|
||||
}
|
||||
id = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue