mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
Fix heap corruption coming out of running scripts dialog
This commit is contained in:
parent
4439de240a
commit
d50c448151
1 changed files with 25 additions and 3 deletions
|
@ -40,9 +40,25 @@ ScrollingWindow {
|
||||||
property alias y: root.y
|
property alias y: root.y
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: refreshTimer
|
||||||
|
interval: 100
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
onTriggered: updateRunningScripts();
|
||||||
|
}
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: listModelBuilder
|
||||||
|
ListModel { }
|
||||||
|
}
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: ScriptDiscoveryService
|
target: ScriptDiscoveryService
|
||||||
onScriptCountChanged: updateRunningScripts();
|
onScriptCountChanged: {
|
||||||
|
runningScriptsModel = listModelBuilder.createObject(root);
|
||||||
|
refreshTimer.restart();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
@ -65,10 +81,16 @@ ScrollingWindow {
|
||||||
b = simplify(b.path);
|
b = simplify(b.path);
|
||||||
return a < b ? -1 : a > b ? 1 : 0;
|
return a < b ? -1 : a > b ? 1 : 0;
|
||||||
});
|
});
|
||||||
runningScriptsModel.clear()
|
// Calling `runningScriptsModel.clear()` here instead of creating a new object
|
||||||
|
// triggers some kind of weird heap corruption deep inside Qt. So instead of
|
||||||
|
// modifying the model in place, possibly triggering behaviors in the table
|
||||||
|
// instead we create a new `ListModel`, populate it and update the
|
||||||
|
// existing model atomically.
|
||||||
|
var newRunningScriptsModel = listModelBuilder.createObject(root);
|
||||||
for (var i = 0; i < runningScripts.length; ++i) {
|
for (var i = 0; i < runningScripts.length; ++i) {
|
||||||
runningScriptsModel.append(runningScripts[i]);
|
newRunningScriptsModel.append(runningScripts[i]);
|
||||||
}
|
}
|
||||||
|
runningScriptsModel = newRunningScriptsModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadScript(script) {
|
function loadScript(script) {
|
||||||
|
|
Loading…
Reference in a new issue