summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@gnome.org>2015-09-30 12:38:55 +0200
committerDebarshi Ray <debarshir@gnome.org>2015-09-30 18:36:24 +0200
commitb75a1896e740b3486a01961803fc304e0d3b3efe (patch)
tree4562cfad3a14c6f5fafa7c8c7205ec5d58ea210c
parentdc7040d7f8b81658817b0a633092f85a4f4963fd (diff)
downloadgvfs-b75a1896e740b3486a01961803fc304e0d3b3efe.tar.gz
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
-rw-r--r--monitor/proxy/gproxyvolumemonitor.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/monitor/proxy/gproxyvolumemonitor.c b/monitor/proxy/gproxyvolumemonitor.c
index 623cb147..17474a84 100644
--- a/monitor/proxy/gproxyvolumemonitor.c
+++ b/monitor/proxy/gproxyvolumemonitor.c
@@ -867,6 +867,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" */
@@ -881,6 +883,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
@@ -891,6 +895,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))
{
@@ -914,6 +920,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