Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
5.15.2
-
None
-
a0470ec261 (qt/qtbase/dev) a0470ec261 (qt/tqtc-qtbase/dev) e9b27e376e (qt/qtbase/6.3) e9b27e376e (qt/tqtc-qtbase/6.3)
Description
QProxyStyle::deleteLater() does not result in deletion of the QProxyStyle, because of incorrect handling of QEvent::DeferredDelete in QProxyStyle::event().
DeferredDelete is normally handled in the base QObject::event() handler, but QProxyStyle::event() forwards all events to the base style – as a result, QObject::event() does not get called for the QProxyStyle itself, and it does not get deleted.
bool QProxyStyle::event(QEvent *e) { Q_D (QProxyStyle); d->ensureBaseStyle(); return d->baseStyle->event(e); }
A simple fix would be to add code similar to the following to the beginning of the function:
bool QProxyStyle::event(QEvent *e) { if (e->type() == QEvent::DeferredDelete) return QObject::event(e); ...
Test case is attached.