e994803
diff -up gvfs-1.0.1/monitor/hal/ghalvolume.c.fix-mounting gvfs-1.0.1/monitor/hal/ghalvolume.c
e994803
--- gvfs-1.0.1/monitor/hal/ghalvolume.c.fix-mounting	2008-09-10 11:51:23.000000000 -0400
e994803
+++ gvfs-1.0.1/monitor/hal/ghalvolume.c	2008-09-29 12:16:02.000000000 -0400
e994803
@@ -760,9 +760,10 @@ spawn_cb (GPid pid, gint status, gpointe
e994803
   GSimpleAsyncResult *simple;
e994803
 
e994803
   /* ensure that the #GHalMount corrosponding to the #GHalVolume we've
e994803
-   * mounted is made available before returning to the user
e994803
+   * mounted is made available before returning to the user (make sure
e994803
+   * we don't emit the signals in idle; see #552168).
e994803
    */
e994803
-  g_hal_volume_monitor_force_update (G_HAL_VOLUME_MONITOR (G_HAL_VOLUME (data->object)->volume_monitor));
e994803
+  g_hal_volume_monitor_force_update (G_HAL_VOLUME_MONITOR (G_HAL_VOLUME (data->object)->volume_monitor), FALSE);
e994803
 
e994803
   if (WEXITSTATUS (status) != 0)
e994803
     {
e994803
diff -up gvfs-1.0.1/monitor/hal/ghalvolumemonitor.c.fix-mounting gvfs-1.0.1/monitor/hal/ghalvolumemonitor.c
e994803
--- gvfs-1.0.1/monitor/hal/ghalvolumemonitor.c.fix-mounting	2008-09-10 11:51:13.000000000 -0400
e994803
+++ gvfs-1.0.1/monitor/hal/ghalvolumemonitor.c	2008-09-29 12:16:02.000000000 -0400
e994803
@@ -82,7 +82,8 @@ static void hal_changed              (Ha
e994803
                                       HalDevice  *device,
e994803
                                       gpointer    user_data);
e994803
 static void update_all               (GHalVolumeMonitor *monitor,
e994803
-                                      gboolean emit_changes);
e994803
+                                      gboolean emit_changes,
e994803
+                                      gboolean emit_in_idle);
e994803
 static void update_drives            (GHalVolumeMonitor *monitor,
e994803
                                       GList **added_drives,
e994803
                                       GList **removed_drives);
e994803
@@ -367,7 +368,7 @@ mountpoints_changed (GUnixMountMonitor *
e994803
 {
e994803
   GHalVolumeMonitor *monitor = G_HAL_VOLUME_MONITOR (user_data);
e994803
 
e994803
-  update_all (monitor, TRUE);
e994803
+  update_all (monitor, TRUE, TRUE);
e994803
 }
e994803
 
e994803
 static void
e994803
@@ -376,13 +377,13 @@ mounts_changed (GUnixMountMonitor *mount
e994803
 {
e994803
   GHalVolumeMonitor *monitor = G_HAL_VOLUME_MONITOR (user_data);
e994803
 
e994803
-  update_all (monitor, TRUE);
e994803
+  update_all (monitor, TRUE, TRUE);
e994803
 }
e994803
 
e994803
 void 
e994803
-g_hal_volume_monitor_force_update (GHalVolumeMonitor *monitor)
e994803
+g_hal_volume_monitor_force_update (GHalVolumeMonitor *monitor, gboolean emit_in_idle)
e994803
 {
e994803
-  update_all (monitor, TRUE);
e994803
+  update_all (monitor, TRUE, emit_in_idle);
e994803
 }
e994803
 
e994803
 static void
e994803
@@ -394,7 +395,7 @@ hal_changed (HalPool    *pool,
e994803
   
e994803
   /*g_warning ("hal changed");*/
e994803
   
e994803
-  update_all (monitor, TRUE);
e994803
+  update_all (monitor, TRUE, TRUE);
e994803
 }
e994803
 
e994803
 static GObject *
e994803
@@ -448,7 +449,7 @@ g_hal_volume_monitor_constructor (GType 
e994803
                     "device_removed", G_CALLBACK (hal_changed),
e994803
                     monitor);
e994803
 		    
e994803
-  update_all (monitor, FALSE);
e994803
+  update_all (monitor, FALSE, TRUE);
e994803
 
e994803
   G_LOCK (hal_vm);
e994803
   the_volume_monitor = monitor;
e994803
@@ -973,7 +974,8 @@ emit_lists_in_idle (gpointer data)
e994803
 /* Must be called from idle if emit_changes, with no locks held */
e994803
 static void
e994803
 update_all (GHalVolumeMonitor *monitor,
e994803
-            gboolean emit_changes)
e994803
+            gboolean emit_changes,
e994803
+            gboolean emit_in_idle)
e994803
 {
e994803
   ChangedLists *lists;
e994803
   GList *added_drives, *removed_drives;
e994803
@@ -1007,7 +1009,10 @@ update_all (GHalVolumeMonitor *monitor,
e994803
       lists->added_mounts = added_mounts;
e994803
       lists->removed_mounts = removed_mounts;
e994803
       
e994803
-      g_idle_add (emit_lists_in_idle, lists);
e994803
+      if (emit_in_idle)
e994803
+        g_idle_add (emit_lists_in_idle, lists);
e994803
+      else
e994803
+        emit_lists_in_idle (lists);
e994803
     }
e994803
   else
e994803
     {
e994803
diff -up gvfs-1.0.1/monitor/hal/ghalvolumemonitor.h.fix-mounting gvfs-1.0.1/monitor/hal/ghalvolumemonitor.h
e994803
--- gvfs-1.0.1/monitor/hal/ghalvolumemonitor.h.fix-mounting	2008-09-10 11:51:13.000000000 -0400
e994803
+++ gvfs-1.0.1/monitor/hal/ghalvolumemonitor.h	2008-09-29 12:16:02.000000000 -0400
e994803
@@ -51,7 +51,8 @@ struct _GHalVolumeMonitorClass {
e994803
 GType g_hal_volume_monitor_get_type (void) G_GNUC_CONST;
e994803
 
e994803
 GVolumeMonitor *g_hal_volume_monitor_new                          (void);
e994803
-void            g_hal_volume_monitor_force_update                 (GHalVolumeMonitor *monitor);
e994803
+void            g_hal_volume_monitor_force_update                 (GHalVolumeMonitor *monitor,
e994803
+                                                                   gboolean emit_in_idle);
e994803
 
e994803
 G_END_DECLS
e994803
 
e994803
diff -up gvfs-1.0.1/monitor/proxy/gproxyvolume.c.fix-mounting gvfs-1.0.1/monitor/proxy/gproxyvolume.c
e994803
--- gvfs-1.0.1/monitor/proxy/gproxyvolume.c.fix-mounting	2008-09-29 13:26:28.000000000 -0400
e994803
+++ gvfs-1.0.1/monitor/proxy/gproxyvolume.c	2008-09-29 13:26:44.000000000 -0400
e994803
@@ -539,7 +539,7 @@ mount_cb (DBusMessage *reply,
e994803
                                         data->callback,
e994803
                                         data->user_data,
e994803
                                         NULL);
e994803
-  g_simple_async_result_complete (simple);
e994803
+  g_simple_async_result_complete_in_idle (simple);
e994803
   g_object_unref (simple);
e994803
 
e994803
   g_object_unref (data->object);