webOS: Fix allocateTimerId

Change-Id: I8b3777f4035401763d86b0245de43b63573b9ea6
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Jani Hautakangas 2014-06-16 00:32:15 +03:00 committed by Jaeyoon Jung
parent 8a11641bb9
commit 4683b0b57f

View File

@ -90,7 +90,14 @@ Q_GLOBAL_STATIC(QtTimerIdFreeList, timerIdFreeList)
int QAbstractEventDispatcherPrivate::allocateTimerId()
{
return timerIdFreeList()->next();
// This function may be called after timerIdFreeList() has been destructed
// for example in case when application exits without waiting for
// running threads to exit and running thread finished() has been connected
// to a slot which triggers a sequence that registers new timer.
// See https://bugreports.qt-project.org/browse/QTBUG-38957.
if (QtTimerIdFreeList *fl = timerIdFreeList())
return fl->next();
return 0; // Note! returning 0 generates a warning
}
void QAbstractEventDispatcherPrivate::releaseTimerId(int timerId)