summaryrefslogtreecommitdiff
path: root/src/controls/qquickmenu.cpp
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-11-17 14:04:59 +0100
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-11-17 15:46:14 +0000
commit61db1507f30082c661c46410115ca74f74842ca7 (patch)
tree453a3ac408f8eeda25c3d9560b723c1ec3204f86 /src/controls/qquickmenu.cpp
parent0f3f31334485dab7ff21a01c14f9411c05901f2b (diff)
downloadqtquickcontrols-61db1507f30082c661c46410115ca74f74842ca7.tar.gz
Fix proxy menu crash
Mobile-centric ApplicationWindowStyle implementations (Flat & Android) use a proxy menu to morph menubar items into a single menu button. The items are owned by the menubar and must not be deleted by the proxy menu. Otherwise, depending on the destruction order, the items would get deleted twice. Change-Id: I92d0c45fc3274574fd1edf34d8d3d081990f2727 Task-number: QTBUG-48927 Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/controls/qquickmenu.cpp')
-rw-r--r--src/controls/qquickmenu.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp
index bc9e7c5d..84f7b1aa 100644
--- a/src/controls/qquickmenu.cpp
+++ b/src/controls/qquickmenu.cpp
@@ -266,7 +266,8 @@ QQuickMenu::QQuickMenu(QObject *parent)
m_containersCount(0),
m_xOffset(0),
m_yOffset(0),
- m_triggerCount(0)
+ m_triggerCount(0),
+ m_proxy(false)
{
connect(this, SIGNAL(__textChanged()), this, SIGNAL(titleChanged()));
@@ -766,6 +767,11 @@ void QQuickMenu::clear()
m_containers.clear();
m_containersCount = 0;
+ // QTBUG-48927: a proxy menu (ApplicationWindowStyle.qml) must not
+ // delete its items, because they are owned by the menubar
+ if (m_proxy)
+ m_menuItems.clear();
+
while (!m_menuItems.empty())
delete m_menuItems.takeFirst();
m_itemsCount = 0;