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
Pick-to: 6.6
Change-Id: Ic2d33ac3aa2ec3ca0261be9996920aae260e16fd
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Ievgenii Meshcheriakov 2023-08-15 11:38:34 +02:00
parent e26a87f1ec
commit cff1c12eca
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;