summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmenu
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-11-16 15:29:34 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-11-16 15:45:28 (GMT)
commitdc2cb80ceb35edd958685189e9075ac1061870f4 (patch)
tree705c27d553caaad06396d2c75cadfcbfcac6ddd6 /tests/auto/qmenu
parent9da9339e4ced8d8c54a4585d3e94cbe6a2d9c574 (diff)
downloadQt-dc2cb80ceb35edd958685189e9075ac1061870f4.zip
Qt-dc2cb80ceb35edd958685189e9075ac1061870f4.tar.gz
Qt-dc2cb80ceb35edd958685189e9075ac1061870f4.tar.bz2
QMenu: do not crash if action is destroyed in the triggered signal.
Task-number: QTBUG-4480 Reviewed-by: Thierry
Diffstat (limited to 'tests/auto/qmenu')
-rw-r--r--tests/auto/qmenu/tst_qmenu.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp
index f12fa92..f0f69a4 100644
--- a/tests/auto/qmenu/tst_qmenu.cpp
+++ b/tests/auto/qmenu/tst_qmenu.cpp
@@ -101,11 +101,13 @@ private slots:
void menuSizeHint();
void task258920_mouseBorder();
void setFixedWidth();
+ void deleteActionInTriggered();
protected slots:
void onActivated(QAction*);
void onHighlighted(QAction*);
void onStatusMessageChanged(const QString &);
void onStatusTipTimer();
+ void deleteAction(QAction *a) { delete a; }
private:
void createActions();
QMenu *menus[2], *lastMenu;
@@ -858,6 +860,17 @@ void tst_QMenu::setFixedWidth()
QCOMPARE(menu.sizeHint().width(), menu.minimumWidth());
}
+void tst_QMenu::deleteActionInTriggered()
+{
+ // should not crash
+ QMenu m;
+ QObject::connect(&m, SIGNAL(triggered(QAction*)), this, SLOT(deleteAction(QAction*)));
+ QWeakPointer<QAction> a = m.addAction("action");
+ a.data()->trigger();
+ QVERIFY(!a);
+}
+
+
QTEST_MAIN(tst_QMenu)