From b27a01a86e614207025e569926d0c419857e8965 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 24 Sep 2015 19:56:23 +0200 Subject: 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 --- tests/auto/controls/data/tst_combobox.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 057ff471..da8c79f8 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -524,7 +524,7 @@ TestCase { verify(comboBox.data[menuIndex].__popupVisible) // close the menu before destroying the combobox - comboBox.data[menuIndex].__closeMenu() + comboBox.data[menuIndex].__closeAndDestroy() verify(!comboBox.data[menuIndex].__popupVisible) comboBox.destroy() @@ -550,7 +550,7 @@ TestCase { verify(comboBox.data[menuIndex].items[i].checked) } // close the menu before destroying the combobox - comboBox.data[menuIndex].__closeMenu() + comboBox.data[menuIndex].__closeAndDestroy() verify(!comboBox.data[menuIndex].__popupVisible) comboBox.destroy() } -- cgit v1.2.1