[maemo-commits] [maemo-commits] r16186 - projects/haf/branches/hildon-thumbnail/daemonize/daemon

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Sep 23 14:31:41 EEST 2008
Author: pvanhoof
Date: 2008-09-23 14:31:40 +0300 (Tue, 23 Sep 2008)
New Revision: 16186

Modified:
   projects/haf/branches/hildon-thumbnail/daemonize/daemon/thumbnailer.c
Log:
Thread safety

Modified: projects/haf/branches/hildon-thumbnail/daemonize/daemon/thumbnailer.c
===================================================================
--- projects/haf/branches/hildon-thumbnail/daemonize/daemon/thumbnailer.c	2008-09-23 11:27:30 UTC (rev 16185)
+++ projects/haf/branches/hildon-thumbnail/daemonize/daemon/thumbnailer.c	2008-09-23 11:31:40 UTC (rev 16186)
@@ -78,11 +78,12 @@
 {
 	ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (object);
 
+	g_mutex_lock (priv->mutex);
 	g_hash_table_insert (priv->plugins, 
 			     g_strdup (mime_type), 
 			     plugin);
 	manager_i_have (priv->manager, mime_type);
-
+	g_mutex_unlock (priv->mutex);
 }
 
 static gboolean 
@@ -98,9 +99,11 @@
 {
 	ThumbnailerPrivate *priv = THUMBNAILER_GET_PRIVATE (object);
 
+	g_mutex_lock (priv->mutex);
 	g_hash_table_foreach_remove (priv->plugins, 
 				     do_delete_or_not, 
 				     plugin);
+	g_mutex_unlock (priv->mutex);
 }
 
 
@@ -352,7 +355,12 @@
 		 * plugin have a go at it */
 
 		} else {
-			GModule *module = g_hash_table_lookup (priv->plugins, key);
+			GModule *module;
+
+			g_mutex_lock (priv->mutex);
+			module = g_hash_table_lookup (priv->plugins, key);
+			g_mutex_unlock (priv->mutex);
+
 			if (module) {
 				GError *error = NULL;
 


More information about the maemo-commits mailing list