Commit 2b308e33 authored by David McFarland's avatar David McFarland Committed by The Qt Project
Browse files

Fix for script errors when unloading a SplitView


Disconnects all signals from child items on destruction

Task-number: QTBUG-32526

Change-Id: Ib0b2e13be549164d4c967359856971c9d08d2a6f
Reviewed-by: default avatarRichard Moe Gustavsen <richard.gustavsen@digia.com>
parent e59cc3ff
No related merge requests found
Showing with 10 additions and 0 deletions
...@@ -195,6 +195,8 @@ Item { ...@@ -195,6 +195,8 @@ Item {
handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1}) handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1})
item.parent = splitterItems item.parent = splitterItems
i-- // item was removed from list i-- // item was removed from list
// should match disconnections in Component.onDestruction
item.widthChanged.connect(d.updateLayout) item.widthChanged.connect(d.updateLayout)
item.heightChanged.connect(d.updateLayout) item.heightChanged.connect(d.updateLayout)
item.Layout.maximumWidthChanged.connect(d.updateLayout) item.Layout.maximumWidthChanged.connect(d.updateLayout)
...@@ -484,6 +486,14 @@ Item { ...@@ -484,6 +486,14 @@ Item {
Component.onDestruction: { Component.onDestruction: {
for (var i=0; i<splitterItems.children.length; ++i) { for (var i=0; i<splitterItems.children.length; ++i) {
var item = splitterItems.children[i]; var item = splitterItems.children[i];
// should match connections in init()
item.widthChanged.disconnect(d.updateLayout)
item.heightChanged.disconnect(d.updateLayout)
item.Layout.maximumWidthChanged.disconnect(d.updateLayout)
item.Layout.minimumWidthChanged.disconnect(d.updateLayout)
item.Layout.maximumHeightChanged.disconnect(d.updateLayout)
item.Layout.minimumHeightChanged.disconnect(d.updateLayout)
item.visibleChanged.disconnect(d.updateFillIndex) item.visibleChanged.disconnect(d.updateFillIndex)
item.Layout.fillWidthChanged.disconnect(d.updateFillIndex) item.Layout.fillWidthChanged.disconnect(d.updateFillIndex)
item.Layout.fillHeightChanged.disconnect(d.updateFillIndex) item.Layout.fillHeightChanged.disconnect(d.updateFillIndex)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment