summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2008-02-28 15:28:21 +0000
committerAlexander Larsson <alexl@src.gnome.org>2008-02-28 15:28:21 +0000
commitc6ffd646e6092d8f2049c464a8c9fa4e666d38c7 (patch)
tree65435a617d9bf5833da32251fa26edc92ba5f81b /client
parent2ada4a0786a5c1f822fd9d36d1cd4845581c3c34 (diff)
downloadgvfs-c6ffd646e6092d8f2049c464a8c9fa4e666d38c7.tar.gz
Emit signals outside of the lock to avoid deadlocks (#519250)
2008-02-28 Alexander Larsson <alexl@redhat.com> * client/gdaemonvolumemonitor.c: (mount_added): (mount_removed): Emit signals outside of the lock to avoid deadlocks (#519250) svn path=/trunk/; revision=1424
Diffstat (limited to 'client')
-rw-r--r--client/gdaemonvolumemonitor.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/client/gdaemonvolumemonitor.c b/client/gdaemonvolumemonitor.c
index 9431304e..c1f79d3b 100644
--- a/client/gdaemonvolumemonitor.c
+++ b/client/gdaemonvolumemonitor.c
@@ -148,7 +148,9 @@ mount_added (GDaemonVolumeMonitor *daemon_monitor, GMountInfo *mount_info)
if (mount)
{
g_warning (G_STRLOC ": Mount was added twice!");
- goto out;
+
+ G_UNLOCK (_the_daemon_volume_monitor);
+ return;
}
if (mount_info->user_visible)
@@ -158,11 +160,19 @@ mount_added (GDaemonVolumeMonitor *daemon_monitor, GMountInfo *mount_info)
if (volume != NULL)
g_daemon_mount_set_foreign_volume (mount, volume);
daemon_monitor->mounts = g_list_prepend (daemon_monitor->mounts, mount);
- g_signal_emit_by_name (daemon_monitor, "mount_added", mount);
- }
- out:
+ /* Ref for the signal emission, other ref is owned by volume monitor */
+ g_object_ref (mount);
+ }
+
G_UNLOCK (_the_daemon_volume_monitor);
+
+ if (mount)
+ {
+ /* Emit signal outside lock */
+ g_signal_emit_by_name (daemon_monitor, "mount_added", mount);
+ g_object_unref (mount);
+ }
}
static void
@@ -177,16 +187,19 @@ mount_removed (GDaemonVolumeMonitor *daemon_monitor, GMountInfo *mount_info)
{
if (mount_info->user_visible)
g_warning (G_STRLOC ": An unknown mount was removed!");
- goto out;
+
+ G_UNLOCK (_the_daemon_volume_monitor);
+ return;
}
daemon_monitor->mounts = g_list_remove (daemon_monitor->mounts, mount);
+
+ G_UNLOCK (_the_daemon_volume_monitor);
+
g_signal_emit_by_name (daemon_monitor, "mount_removed", mount);
g_signal_emit_by_name (mount, "unmounted");
+
g_object_unref (mount);
-
- out:
- G_UNLOCK (_the_daemon_volume_monitor);
}
static void