From 3799188e704e48ff8e9aa728cd76101b15f21fd2 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 7 Sep 2015 14:35:47 +0200 Subject: Menu: Schedule popup deletion when it's about to hide This leads to serious memory/OpenGL context leaks on Windows. No such thing has been noticed on Linux which may hint to differences in the backend. Task-number: QTBUG-47682 Change-Id: I274ed98db348ffe2c78707f2c92b812f272c2723 Reviewed-by: Mitch Curtis --- src/controls/Menu.qml | 2 +- src/controls/MenuBar.qml | 2 +- tests/auto/controls/data/tst_combobox.qml | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/controls/Menu.qml b/src/controls/Menu.qml index 7334c28c..0eb0c357 100644 --- a/src/controls/Menu.qml +++ b/src/controls/Menu.qml @@ -150,7 +150,7 @@ MenuPrivate { /*! \internal */ property int __currentIndex: -1 /*! \internal */ - onAboutToHide: __currentIndex = -1 + onAboutToHide: { __currentIndex = -1; __destroyMenuPopup() } on__MenuPopupDestroyed: contentLoader.active = false onPopupVisibleChanged: { if (__popupVisible) diff --git a/src/controls/MenuBar.qml b/src/controls/MenuBar.qml index 0d9f8ee8..be182e29 100644 --- a/src/controls/MenuBar.qml +++ b/src/controls/MenuBar.qml @@ -302,7 +302,7 @@ MenuBarPrivate { anchors.fill: parent hoverEnabled: Settings.hoverEnabled - onPositionChanged: updateCurrentItem(mouse, false) + onPositionChanged: updateCurrentItem(mouse) onPressed: { if (updateCurrentItem(mouse)) { d.preselectMenuItem = false diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index af1fc9dd..057ff471 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -74,6 +74,7 @@ TestCase { function cleanup() { if (model !== 0) model.destroy() + wait(0) // spin the event loop to get all popups to close } function test_keyupdown() { -- cgit v1.2.1