fix Qt 5.8 crash on app exit bug in StandardDialog

This commit is contained in:
Jaquee 2017-08-08 10:46:36 +02:00
parent d437b98a12
commit 1c7f529141

View file

@ -38,6 +38,9 @@ Item {
property string textColor: "#FFFFFF" property string textColor: "#FFFFFF"
property alias currentIndex: column.currentIndex property alias currentIndex: column.currentIndex
property bool expanded: false property bool expanded: false
signal changed();
height: 37 * scaleRatio height: 37 * scaleRatio
onExpandedChanged: if(expanded) appWindow.currentItem = dropdown onExpandedChanged: if(expanded) appWindow.currentItem = dropdown
@ -54,6 +57,12 @@ Item {
return true 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 { Item {
id: head id: head
anchors.left: parent.left anchors.left: parent.left
@ -107,7 +116,6 @@ Item {
font.bold: true font.bold: true
font.pixelSize: 12 * scaleRatio font.pixelSize: 12 * scaleRatio
color: "#FFFFFF" color: "#FFFFFF"
text: column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column1) + translationManager.emptyString : ""
} }
Text { Text {
@ -119,8 +127,6 @@ Item {
font.family: "Arial" font.family: "Arial"
font.pixelSize: 12 * scaleRatio font.pixelSize: 12 * scaleRatio
color: "#FFFFFF" color: "#FFFFFF"
text: column.currentIndex < repeater.model.rowCount() ? qsTr(repeater.model.get(column.currentIndex).column2) + translationManager.emptyString : ""
property int w: 0 property int w: 0
Component.onCompleted: w = implicitWidth Component.onCompleted: w = implicitWidth
} }
@ -258,6 +264,8 @@ Item {
onClicked: { onClicked: {
dropdown.expanded = false dropdown.expanded = false
column.currentIndex = index column.currentIndex = index
changed();
dropdown.update()
} }
} }
} }