summaryrefslogtreecommitdiffstats
path: root/kde/patch/kdelibs/kdelibs.fstab.patch
blob: a57662b3fc513bb710fe4d854e0879d2ea88d24b (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
From: Alex Fiestas <afiestas@kde.org>
Date: Tue, 05 Jun 2012 16:12:28 +0000
Subject: Emit deviceRemoved/Added with the right deviceList set
X-Git-Url: http://quickgit.kde.org/?p=kdelibs.git&amp;a=commitdiff&amp;h=19213a6c34e1b47a100815ccbfee8b5c70c3c12a
---
Emit deviceRemoved/Added with the right deviceList set

The problem is quite straightforward, deviceAdded is being emitted when
the m_deviceList has the OLD list, so the new device is still NOT in it.
If the user of the library instances a device Solid::Device(UDI) in the
slot after that signal, the device will be null because it will not be
found in m_deviceList.

REVIEW: 105132
---


--- a/solid/solid/backends/fstab/fstabmanager.cpp
+++ b/solid/solid/backends/fstab/fstabmanager.cpp
@@ -116,17 +116,19 @@ void FstabManager::_k_updateDeviceList()
     QSet<QString> newlist = deviceList.toSet();
     QSet<QString> oldlist = m_deviceList.toSet();
 
-    foreach(const QString &device, newlist) {
-        if ( !oldlist.contains(device) )
-            emit deviceAdded(udiPrefix() + "/" + device);
-    }
-
     foreach(const QString &device, oldlist) {
-        if ( !newlist.contains(device) )
+        if ( !newlist.contains(device) ) {
             emit deviceRemoved(udiPrefix() + "/" + device);
+        }
     }
 
     m_deviceList = deviceList;
+
+    foreach(const QString &device, newlist) {
+        if ( !oldlist.contains(device) ) {
+            emit deviceAdded(udiPrefix() + "/" + device);
+        }
+    }
 }
 
 void FstabManager::onMtabChanged()