From dc2cb80ceb35edd958685189e9075ac1061870f4 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 16 Nov 2009 16:29:34 +0100 Subject: QMenu: do not crash if action is destroyed in the triggered signal. Task-number: QTBUG-4480 Reviewed-by: Thierry --- src/gui/widgets/qmenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/gui/widgets/qmenu.cpp') diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 54d1612f15..fc88d06600 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1106,6 +1106,7 @@ void QMenuPrivate::_q_actionTriggered() { Q_Q(QMenu); if (QAction *action = qobject_cast(q->sender())) { + QWeakPointer actionGuard = action; #ifdef QT3_SUPPORT //we store it here because the action might be deleted/changed by connected slots const int id = q->findIdForAction(action); @@ -1115,7 +1116,7 @@ void QMenuPrivate::_q_actionTriggered() emit q->activated(id); #endif - if (!activationRecursionGuard) { + if (!activationRecursionGuard && actionGuard) { //in case the action has not been activated by the mouse //we check the parent hierarchy QList< QPointer > list; -- cgit v1.2.1