QAbstractEventDispatcherPrivate: Create free timer ID list in constructor

Create the global static free timer ID list in the constructor
so that it is destroyed after any global static QDaemonThread instance
that may be using it.

Fixes: QTBUG-58732
Change-Id: Ic2d33ac3aa2ec3ca0261be9996920aae260e16fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
(cherry picked from commit cff1c12eca6e1e7d2645f7079895718193beb621)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Ievgenii Meshcheriakov 2023-08-15 11:38:34 +02:00 committed by Qt Cherry-pick Bot
parent b29f12be3e
commit 2fd12c03cd
2 changed files with 10 additions and 2 deletions

View File

@ -52,6 +52,15 @@ Q_CONSTINIT const int QtTimerIdFreeListConstants::Sizes[QtTimerIdFreeListConstan
typedef QFreeList<void, QtTimerIdFreeListConstants> QtTimerIdFreeList;
Q_GLOBAL_STATIC(QtTimerIdFreeList, timerIdFreeList)
QAbstractEventDispatcherPrivate::QAbstractEventDispatcherPrivate()
{
// Create the timer ID free list here to make sure that it is destroyed
// after any global static thread that may be using it.
// See also QTBUG-58732.
if (!timerIdFreeList.isDestroyed())
(void)timerIdFreeList();
}
QAbstractEventDispatcherPrivate::~QAbstractEventDispatcherPrivate()
= default;

View File

@ -26,8 +26,7 @@ class Q_CORE_EXPORT QAbstractEventDispatcherPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QAbstractEventDispatcher)
public:
inline QAbstractEventDispatcherPrivate()
{ }
QAbstractEventDispatcherPrivate();
~QAbstractEventDispatcherPrivate() override;
QList<QAbstractNativeEventFilter *> eventFilters;