[gvfs/gnome-3-14] proxy volume monitor: Guard access to the internal caches



commit a83afca5d2f10d46712f75d53690bd029f0aebef
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Sep 30 12:38:55 2015 +0200

    proxy volume monitor: Guard access to the internal caches
    
    Accesses to the drives, volumes and mounts hash tables should be
    guarded by the proxy_vm mutex.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=755805

 monitor/proxy/gproxyvolumemonitor.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/monitor/proxy/gproxyvolumemonitor.c b/monitor/proxy/gproxyvolumemonitor.c
index 7f05b39..b05b8c7 100644
--- a/monitor/proxy/gproxyvolumemonitor.c
+++ b/monitor/proxy/gproxyvolumemonitor.c
@@ -864,6 +864,8 @@ name_owner_appeared (GProxyVolumeMonitor *monitor)
   GProxyVolume *volume;
   GProxyMount *mount;
 
+  G_LOCK (proxy_vm);
+
   seed_monitor (monitor);
 
   /* emit signals for all the drives/volumes/mounts "added" */
@@ -878,6 +880,8 @@ name_owner_appeared (GProxyVolumeMonitor *monitor)
   g_hash_table_iter_init (&hash_iter, monitor->mounts);
   while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer) &mount))
     signal_emit_in_idle (monitor, "mount-added", mount);
+
+  G_UNLOCK (proxy_vm);
 }
 
 static void
@@ -888,6 +892,8 @@ name_owner_vanished (GProxyVolumeMonitor *monitor)
   GProxyVolume *volume;
   GProxyMount *mount;
 
+  G_LOCK (proxy_vm);
+
   g_hash_table_iter_init (&hash_iter, monitor->mounts);
   while (g_hash_table_iter_next (&hash_iter, NULL, (gpointer) &mount))
     {
@@ -911,6 +917,8 @@ name_owner_vanished (GProxyVolumeMonitor *monitor)
       signal_emit_in_idle (monitor, "drive-disconnected", drive);
     }
   g_hash_table_remove_all (monitor->drives);
+
+  G_UNLOCK (proxy_vm);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]