From 2b308e33bec09c8a792b37282f6172a59dc3d543 Mon Sep 17 00:00:00 2001 From: David McFarland <corngood@gmail.com> Date: Fri, 19 Jul 2013 22:44:53 -0300 Subject: [PATCH] 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: Richard Moe Gustavsen <richard.gustavsen@digia.com> --- src/controls/SplitView.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/controls/SplitView.qml b/src/controls/SplitView.qml index 1cc8199ff..e8d6fc9a2 100644 --- a/src/controls/SplitView.qml +++ b/src/controls/SplitView.qml @@ -195,6 +195,8 @@ Item { handleLoader.createObject(splitterHandles, {"__handleIndex":splitterItems.children.length - 1}) item.parent = splitterItems i-- // item was removed from list + + // should match disconnections in Component.onDestruction item.widthChanged.connect(d.updateLayout) item.heightChanged.connect(d.updateLayout) item.Layout.maximumWidthChanged.connect(d.updateLayout) @@ -484,6 +486,14 @@ Item { Component.onDestruction: { for (var i=0; i<splitterItems.children.length; ++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.Layout.fillWidthChanged.disconnect(d.updateFillIndex) item.Layout.fillHeightChanged.disconnect(d.updateFillIndex) -- GitLab