summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmenu_p.h
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-04-24 13:55:00 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-25 17:56:26 +0200
commit370e89f06465a4d61c7b72291115cd7b5a0d576a (patch)
tree32fbbbadf068938960c7678799da261bc00f2f61 /src/widgets/widgets/qmenu_p.h
parent7a1cdac05264204d01f729bb2e1201e08bb9fe3e (diff)
Cocoa: Reflect menu hierarchy in QCocoaMenu* objects
QCocoaMenu is child of either a QCocoaMenuBar, a QCocoaMenuItem as a submenu, or nothing as a standalone menu. QCocoaMenuItem is child of its containing QCocoaMenu. The parent is set during insertion and cleared during removal. QMenu needs to be updated to avoid double deletion and leaking its own platform menu. Change-Id: Iadf60d8062d7466fa616f84f3761fe322fc9aa2e Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
Diffstat (limited to 'src/widgets/widgets/qmenu_p.h')
-rw-r--r--src/widgets/widgets/qmenu_p.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h
index 6cc88c56e2..15f3c92127 100644
--- a/src/widgets/widgets/qmenu_p.h
+++ b/src/widgets/widgets/qmenu_p.h
@@ -101,7 +101,8 @@ public:
~QMenuPrivate()
{
delete scroll;
- delete platformMenu;
+ if (!platformMenu.isNull() && !platformMenu->parent())
+ delete platformMenu.data();
#if defined(Q_OS_WINCE) && !defined(QT_NO_MENUBAR)
delete wce_menu;
#endif
@@ -228,7 +229,7 @@ public:
//menu fading/scrolling effects
bool doChildEffects;
- QPlatformMenu *platformMenu;
+ QPointer<QPlatformMenu> platformMenu;
QPointer<QAction> actionAboutToTrigger;