diff options
author | Andy Shaw <andy.shaw@digia.com> | 2012-08-30 20:40:01 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-09-11 18:48:56 (GMT) |
commit | 6c564607770479173967b9a74926cbe1c4bc109e (patch) | |
tree | a086a5a9469f2b25f235577436d8c10f69cade2a /src | |
parent | ffac77f7de433f67570ff0da9656bce6481be920 (diff) | |
download | Qt-6c564607770479173967b9a74926cbe1c4bc109e.zip Qt-6c564607770479173967b9a74926cbe1c4bc109e.tar.gz Qt-6c564607770479173967b9a74926cbe1c4bc109e.tar.bz2 |
Prevent a crash when a merged action is removed
If a merged action is removed then a crash can occur if it is readded
later.
Task-number: QTBUG-24917
Change-Id: I43dcde3f40950fafc33d976e861a90fe1c38d061
Reviewed-by: Morten Johan Sørvig <morten.sorvig@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/widgets/qmenu_mac.mm | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index f333ce5..325f8e4 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1504,6 +1504,16 @@ QMenuPrivate::QMacMenuPrivate::removeAction(QMacMenuAction *action) && action->menuItem != [loader preferencesMenuItem]) { [[action->menuItem menu] removeItem:action->menuItem]; } + if (QMenuMergeList *list = mergeMenuItemsHash.value(action->menu)) { + int i = 0; + while (i < list->size()) { + const QMenuMergeItem &item = list->at(i); + if (item.action == action) + list->removeAt(i); + else + ++i; + } + } } } else { [[action->menuItem menu] removeItem:action->menuItem]; |