summaryrefslogtreecommitdiffstats
path: root/src/controls/Private/EditMenu_base.qml
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-09-24 19:56:23 +0200
committerGabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>2015-10-01 09:07:59 +0000
commitb27a01a86e614207025e569926d0c419857e8965 (patch)
tree9d3dc7b339f3bc4ed7d2dcdaca17f091376b5aca /src/controls/Private/EditMenu_base.qml
parent79092d8ab8f5c02c5d880d33f9869c034f0f933d (diff)
Menus: Clean popup hide and destroy logic
When a menu popup gets closed it usually needs to be destroyed right away since we don't recycle its contents. There is an exception, however, and it's when he user triggers a menu item. In this case, we need to proceed in three steps. First, we hide the menu popup, then we emit the triggered signal, and when that one returns, the menu contents can be disposed. If we did all in a single step, we may end up with a crash since we don't support deleting a QtQuick item while it's running a signal handler. Delayed deletions don't work either in the case when the triggered handler ends up running the event loop. Task-number: QTBUG-45182 Task-number: QTBUG-47682 Task-number: QTBUG-48382 Change-Id: Ic39717e09f38df602f641250cd81cf4931863db6 Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/controls/Private/EditMenu_base.qml')
-rw-r--r--src/controls/Private/EditMenu_base.qml3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/controls/Private/EditMenu_base.qml b/src/controls/Private/EditMenu_base.qml
index e44ff5992..15fe8d692 100644
--- a/src/controls/Private/EditMenu_base.qml
+++ b/src/controls/Private/EditMenu_base.qml
@@ -161,8 +161,7 @@ Item {
if (control.menu) {
var menu = getMenuInstance();
- menu.__dismissMenu();
- menu.__destroyAllMenuPopups();
+ menu.__dismissAndDestroy();
var menuPos = mapToItem(null, mouse.x, mouse.y)
menu.__popup(Qt.rect(menuPos.x, menuPos.y, 0, 0), -1, MenuPrivate.EditMenu);
}