From 5d8a7652b995124495ef4f4a43fd8cf461367d62 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Thu, 7 Apr 2022 15:24:14 +0200 Subject: QProxyStyle: reimplement event() handling There is no use case for QProxyStyle to forward events to its base style. QApplication does not send events to it; a style using e.g. timers or so will have them active on *itself*, not on the proxy. Moreover, forwarding *all* events is broken: QTBUG-96213 has been triggered by forwarding DeferredDelete events sent to the proxy (thus accidentally deleting the base style). But one can concoct many other similarly broken situations; for instance, setting a proxy onto a base style will make the style a child of the proxy. That sends a QChildEvent to the proxy (ChildAdded), and that event is then passed on the base style, resulting in the base style receiving an event saying "you have yourself as a child". Change-Id: I3b92bb168ce3c54a32469c36b6d1da4380ed564f Reviewed-by: Rafael Roquetto Reviewed-by: Qt CI Bot Reviewed-by: Volker Hilsheimer --- src/widgets/styles/qproxystyle.cpp | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/widgets/styles/qproxystyle.cpp b/src/widgets/styles/qproxystyle.cpp index f138bdda11..585177c30d 100644 --- a/src/widgets/styles/qproxystyle.cpp +++ b/src/widgets/styles/qproxystyle.cpp @@ -382,13 +382,8 @@ 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); + // ### Qt 7: remove this override + return QCommonStyle::event(e); } /*! -- cgit v1.2.3