summarylogtreecommitdiffstats
path: root/0002-Fix-Plasmashell-crash-when-opening-config.patch
blob: eaee2731ba012705b9698896cad84c0179d92dcb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
From 17aaaa5956837335ef677c066c8af4584292f85f Mon Sep 17 00:00:00 2001
From: Zach Himsel <zach@himsel.net>
Date: Mon, 29 Jun 2020 08:59:46 -0600
Subject: [PATCH] Fix Plasmashell crash when opening config

Written by /u/DGLS575 on Reddit:
https://www.reddit.com/r/kdeneon/comments/gkyuij/attempting_to_configure_thermal_monitor_widget/ft3gsvq/
---
 .../contents/ui/config/ConfigTemperatures.qml | 103 +++++++++---------
 1 file changed, 52 insertions(+), 51 deletions(-)

diff --git a/package/contents/ui/config/ConfigTemperatures.qml b/package/contents/ui/config/ConfigTemperatures.qml
index 79b6204..341fad5 100644
--- a/package/contents/ui/config/ConfigTemperatures.qml
+++ b/package/contents/ui/config/ConfigTemperatures.qml
@@ -524,83 +524,84 @@ 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) {
+            if (!prepared)
+            {
+                //atiDS.connectedSources.length = 0
+                if (data['exit code'] > 0) {
+                    prepared = true
+                    return
+                }
+                
+                comboboxModel.append({
+                    text: 'aticonfig',
+                    val: 'aticonfig'
+                })
                 prepared = true
-                return
             }
-            
-            comboboxModel.append({
-                text: 'aticonfig',
-                val: 'aticonfig'
-            })
-            
-            prepared = true
         }
-        
-        interval: 500
+        //interval: 500
     }
-    
+        
 }
-- 
2.27.0