on xenial help sign in
Make sure we destroy the popups when the item goes away
d067964Albert Astals Cid
qml/ApplicationMenus/MenuBar.qml+7
@@ -221,6 +221,13 @@ Item {
221 }
221 }
222 }
222 }
223 }
223 }
224+
225+ Component.onDestruction: {
226+ if (__popup) {
227+ __popup.destroy();
228+ __popup = null;
229+ }
230+ }
224 } // Item ( delegate )
231 } // Item ( delegate )
225 } // Repeater
232 } // Repeater
226 } // Row
233 } // Row
qml/ApplicationMenus/MenuPopup.qml+10−1
@@ -295,6 +295,8 @@ UbuntuShape {
295
295
296 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
296 width: MathUtils.clamp(implicitWidth, d.__minimumWidth, d.__maximumWidth)
297
297
298+ property Item popup: null
299+
298 action.onTriggered: {
300 action.onTriggered: {
299 submenuHoverTimer.stop();
301 submenuHoverTimer.stop();
300
302
@@ -346,6 +348,13 @@ UbuntuShape {
346 }
348 }
347 }
349 }
348 }
350 }
351+
352+ Component.onDestruction: {
353+ if (popup) {
354+ popup.destroy();
355+ popup = null;
356+ }
357+ }
349 }
358 }
350 }
359 }
351
360
@@ -362,7 +371,7 @@ UbuntuShape {
362 id: loader
371 id: loader
363 objectName: root.objectName + "-item" + __ownIndex
372 objectName: root.objectName + "-item" + __ownIndex
364
373
365− property Item popup: null
374+ readonly property var popup: item ? item.popup : null
366 property var __menuData: model
375 property var __menuData: model
367 property int __ownIndex: index
376 property int __ownIndex: index
368 property bool __isSeparator: model.isSeparator
377 property bool __isSeparator: model.isSeparator