From 1c7f529141f4da0a2ab7981c7c1e18daa757e566 Mon Sep 17 00:00:00 2001 From: Jaquee Date: Tue, 8 Aug 2017 10:46:36 +0200 Subject: [PATCH] fix Qt 5.8 crash on app exit bug in StandardDialog --- components/StandardDropdown.qml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/components/StandardDropdown.qml b/components/StandardDropdown.qml index f8b41d9d..5aac249b 100644 --- a/components/StandardDropdown.qml +++ b/components/StandardDropdown.qml @@ -38,6 +38,9 @@ Item { property string textColor: "#FFFFFF" property alias currentIndex: column.currentIndex property bool expanded: false + + signal changed(); + height: 37 * scaleRatio onExpandedChanged: if(expanded) appWindow.currentItem = dropdown @@ -54,6 +57,12 @@ Item { return true } + // Workaroud for suspected memory leak in 5.8 causing malloc crash on app exit + function update() { + firstColText.text = column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column1) + translationManager.emptyString : "" + secondColText.text = column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column2) + translationManager.emptyString : "" + } + Item { id: head anchors.left: parent.left @@ -107,7 +116,6 @@ Item { font.bold: true font.pixelSize: 12 * scaleRatio color: "#FFFFFF" - text: column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column1) + translationManager.emptyString : "" } Text { @@ -119,8 +127,6 @@ Item { font.family: "Arial" font.pixelSize: 12 * scaleRatio color: "#FFFFFF" - text: column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column2) + translationManager.emptyString : "" - property int w: 0 Component.onCompleted: w = implicitWidth } @@ -258,6 +264,8 @@ Item { onClicked: { dropdown.expanded = false column.currentIndex = index + changed(); + dropdown.update() } } }