From a42a4513398a159e4f6749fbcb1309c4a42b4841 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 30 Aug 2019 22:06:17 +0200 Subject: QShortcut: call base class implementation in event() QShortcut::event() did not call the base class implementation QObject::event() which caused that e.g. QEvent::DeferredDelete was not handled. Fix it by calling QObject::event() when the event was not handled. Fixes: QTBUG-66809 Change-Id: Ideebc980bc658f8f2b9ec4417e738bccda5eeab5 Reviewed-by: Volker Hilsheimer --- tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests') diff --git a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp index 2c9295d995..53753e195a 100644 --- a/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp +++ b/tests/auto/widgets/kernel/qshortcut/tst_qshortcut.cpp @@ -123,6 +123,7 @@ private slots: void context(); void duplicatedShortcutOverride(); void shortcutToFocusProxy(); + void deleteLater(); protected: static Qt::KeyboardModifiers toButtons( int key ); @@ -1305,5 +1306,14 @@ void tst_QShortcut::shortcutToFocusProxy() QCOMPARE(le.text(), QString()); } +void tst_QShortcut::deleteLater() +{ + QWidget w; + QPointer sc(new QShortcut(QKeySequence(Qt::Key_1), &w)); + sc->deleteLater(); + QTRY_VERIFY(!sc); +} + + QTEST_MAIN(tst_QShortcut) #include "tst_qshortcut.moc" -- cgit v1.2.3