diff options
author | Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com> | 2015-09-07 14:35:47 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2015-09-11 07:15:34 +0000 |
commit | 3799188e704e48ff8e9aa728cd76101b15f21fd2 (patch) | |
tree | 83c9165bbea1567f5717ce3f7c59c8141f52c99b | |
parent | 5e252f9b9ceea72fc1acb5fb41b81abc34cab46d (diff) | |
download | qtquickcontrols-3799188e704e48ff8e9aa728cd76101b15f21fd2.tar.gz |
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 <mitch.curtis@theqtcompany.com>
-rw-r--r-- | src/controls/Menu.qml | 2 | ||||
-rw-r--r-- | src/controls/MenuBar.qml | 2 | ||||
-rw-r--r-- | 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() { |