diff options
author | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-16 15:29:34 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-11-16 15:45:28 (GMT) |
commit | dc2cb80ceb35edd958685189e9075ac1061870f4 (patch) | |
tree | 705c27d553caaad06396d2c75cadfcbfcac6ddd6 /src | |
parent | 9da9339e4ced8d8c54a4585d3e94cbe6a2d9c574 (diff) | |
download | Qt-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 'src')
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 54d1612..fc88d06 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<QAction *>(q->sender())) { + QWeakPointer<QAction> 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<QWidget> > list; |