From 4ec9e112a59de095881f3b5b8d73c4eddbc19687 Mon Sep 17 00:00:00 2001 From: Vladyslav Andreichykov Date: Sat, 19 Nov 2022 10:57:45 +0200 Subject: [PATCH] Fix Plasmashell crash when opening config #69 --- .../contents/ui/config/ConfigTemperatures.qml | 92 ++++++++++--------- 1 file changed, 47 insertions(+), 45 deletions(-) diff --git a/package/contents/ui/config/ConfigTemperatures.qml b/package/contents/ui/config/ConfigTemperatures.qml index 79b6204..e3484b3 100644 --- a/package/contents/ui/config/ConfigTemperatures.qml +++ b/package/contents/ui/config/ConfigTemperatures.qml @@ -524,72 +524,75 @@ Item { engine: 'executable' connectedSources: [ ModelUtils.UDISKS_DEVICES_CMD ] - + property bool prepared: false + onNewData: { - connectedSources.length = 0 - - if (data['exit code'] > 0) { - print('New data incomming. Source: ' + sourceName + ', ERROR: ' + data.stderr); - return - } - - print('New data incomming. Source: ' + sourceName + ', data: ' + data.stdout); - - var pathsToCheck = ModelUtils.parseUdisksPaths(data.stdout) - pathsToCheck.forEach(function (pathObj) { - var cmd = ModelUtils.UDISKS_VIRTUAL_PATH_PREFIX + pathObj.name - comboboxModel.append({ - text: cmd, - val: cmd + if (!prepared) + { + //connectedSources.length = 0 + + if (data['exit code'] > 0) { + print('New data incomming. Source: ' + sourceName + ', ERROR: ' + data.stderr); + return + } + + print('New data incomming. Source: ' + sourceName + ', data: ' + data.stdout); + + var pathsToCheck = ModelUtils.parseUdisksPaths(data.stdout) + pathsToCheck.forEach(function (pathObj) { + var cmd = ModelUtils.UDISKS_VIRTUAL_PATH_PREFIX + pathObj.name + comboboxModel.append({ + text: cmd, + val: cmd + }) }) - }) - + prepared = true + } } - - interval: 500 + //interval: 500 } - + PlasmaCore.DataSource { id: nvidiaDS engine: 'executable' connectedSources: [ 'nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader' ] - property bool prepared: false onNewData: { - nvidiaDS.connectedSources.length = 0 - - if (data['exit code'] > 0) { + if (!prepared) + { + //nvidiaDS.connectedSources.length = 0 + if (data['exit code'] > 0) { + prepared = true + return + } + + comboboxModel.append({ + text: 'nvidia-smi', + val: 'nvidia-smi' + }) prepared = true - return } - - comboboxModel.append({ - text: 'nvidia-smi', - val: 'nvidia-smi' - }) - - prepared = true } - - interval: 500 + //interval: 500 } - + PlasmaCore.DataSource { id: atiDS engine: 'executable' connectedSources: [ 'aticonfig --od-gettemperature' ] - property bool prepared: false onNewData: { - atiDS.connectedSources.length = 0 - - if (data['exit code'] > 0) { - prepared = true - return + if (!prepared) + { + //atiDS.connectedSources.length = 0 + if (data['exit code'] > 0) { + prepared = true + return + } } comboboxModel.append({ @@ -599,8 +602,7 @@ Item { prepared = true } - - interval: 500 + //interval: 500 } - + }