[rhythmbox] removable-media-manager: take gdk lock when processing events



commit 70232983c1f0062b8f38c9106372db35f432313f
Author: Jonathan Matthew <jonathan d14n org>
Date:   Tue Oct 11 08:49:32 2011 +1000

    removable-media-manager: take gdk lock when processing events

 shell/rb-removable-media-manager.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/shell/rb-removable-media-manager.c b/shell/rb-removable-media-manager.c
index 8a84e29..747787f 100644
--- a/shell/rb-removable-media-manager.c
+++ b/shell/rb-removable-media-manager.c
@@ -515,7 +515,9 @@ volume_added_cb (GVolumeMonitor *monitor,
 		 GVolume *volume,
 		 RBRemovableMediaManager *mgr)
 {
+	GDK_THREADS_ENTER ();
 	rb_removable_media_manager_add_volume (mgr, volume);
+	GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -523,7 +525,9 @@ volume_removed_cb (GVolumeMonitor *monitor,
 		   GVolume *volume,
 		   RBRemovableMediaManager *mgr)
 {
+	GDK_THREADS_ENTER ();
 	rb_removable_media_manager_remove_volume (mgr, volume);
+	GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -531,7 +535,9 @@ mount_added_cb (GVolumeMonitor *monitor,
 		GMount *mount,
 		RBRemovableMediaManager *mgr)
 {
+	GDK_THREADS_ENTER ();
 	rb_removable_media_manager_add_mount (mgr, mount);
+	GDK_THREADS_LEAVE ();
 }
 
 static void
@@ -549,6 +555,9 @@ uevent_cb (GUdevClient *client, const char *action, GUdevDevice *device, RBRemov
 {
 	RBRemovableMediaManagerPrivate *priv = GET_PRIVATE (mgr);
 	guint64 devnum;
+
+	GDK_THREADS_ENTER ();
+
 	devnum = (guint64) g_udev_device_get_device_number (device);
 	rb_debug ("%s event for %s (%"G_GINT64_MODIFIER"x)", action,
                   g_udev_device_get_sysfs_path (device), devnum);
@@ -559,16 +568,15 @@ uevent_cb (GUdevClient *client, const char *action, GUdevDevice *device, RBRemov
 		/* probably need to filter out devices related to things we've already seen.. */
 		if (g_hash_table_lookup (priv->device_mapping, &devnum) != NULL) {
 			rb_debug ("already have a source for this device");
-			return;
-		}
-
-		g_signal_emit (mgr, rb_removable_media_manager_signals[CREATE_SOURCE_DEVICE], 0, device, &source);
-		if (source != NULL) {
-			guint64 *key = g_new0 (guint64, 1);
-			rb_debug ("created a source for this device");
-			key[0] = devnum;
-			g_hash_table_insert (priv->device_mapping, key, source);
-			rb_removable_media_manager_append_media_source (mgr, source);
+		} else {
+			g_signal_emit (mgr, rb_removable_media_manager_signals[CREATE_SOURCE_DEVICE], 0, device, &source);
+			if (source != NULL) {
+				guint64 *key = g_new0 (guint64, 1);
+				rb_debug ("created a source for this device");
+				key[0] = devnum;
+				g_hash_table_insert (priv->device_mapping, key, source);
+				rb_removable_media_manager_append_media_source (mgr, source);
+			}
 		}
 	} else if (g_str_equal (action, "remove")) {
 		RBSource *source;
@@ -579,6 +587,8 @@ uevent_cb (GUdevClient *client, const char *action, GUdevDevice *device, RBRemov
 			rb_display_page_delete_thyself (RB_DISPLAY_PAGE (source));
 		}
 	}
+
+	GDK_THREADS_LEAVE ();
 }
 #endif
 



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