From a0470ec2617357293d13fa5ec2c87efbd3965b4c Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 6 Apr 2022 13:43:54 +0200 Subject: [PATCH] QProxyStyle: do not pass DeferredDelete to baseStyle Calling deleteLater on an object of type QProxyStyle (or inheriting from QProxyStyle) results in this object never deleted, since it simply passes the event to its base style, which in case of deleteLater is not right. QProxyStyle inherits QCommonStyle which in turn inherits QStyle (which is QObject's descendent). So for the style to be deleted we pass DeferredDelete to its base class - QCommonStyle::event (which means QObject::event, since neither QCommonStyle nor QStyle override QObject::event()). Pick-to: 6.3 Fixes: QTBUG-96213 Change-Id: I99b8f413624e2f18ddae3fb331997f767de219d0 Reviewed-by: Friedemann Kleint Reviewed-by: Volker Hilsheimer --- src/widgets/styles/qproxystyle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index 31fe587ce2..f138bdda11 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -383,6 +383,10 @@ void QProxyStyle::unpolish(QApplication *app) bool QProxyStyle::event(QEvent *e) { Q_D (QProxyStyle); + + if (e->type() == QEvent::DeferredDelete) + return QCommonStyle::event(e); + d->ensureBaseStyle(); return d->baseStyle->event(e); }