evolution-data-server r8634 - in trunk: . libedataserver



Author: mcrha
Date: Tue Apr 15 13:08:33 2008
New Revision: 8634
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8634&view=rev

Log:
2008-04-15  Milan Crha  <mcrha redhat com>

	** Fix for bug #475616

	* libedataserver/e-component-listener.c: (watched_lock),
	(connection_listen_cb), (e_component_listener_finalize),
	(e_component_listener_new): Use rather rec mutex here.



Modified:
   trunk/ChangeLog
   trunk/libedataserver/e-component-listener.c

Modified: trunk/libedataserver/e-component-listener.c
==============================================================================
--- trunk/libedataserver/e-component-listener.c	(original)
+++ trunk/libedataserver/e-component-listener.c	Tue Apr 15 13:08:33 2008
@@ -24,7 +24,7 @@
 static void e_component_listener_finalize   (GObject *object);
 
 static GList *watched_connections = NULL;
-static GStaticMutex watched_lock = G_STATIC_MUTEX_INIT;
+static GStaticRecMutex watched_lock = G_STATIC_REC_MUTEX_INIT;
 
 enum {
 	COMPONENT_DIED,
@@ -39,7 +39,7 @@
 	GList *l, *next = NULL;
 	EComponentListener *cl;
 
-	g_static_mutex_lock (&watched_lock);
+	g_static_rec_mutex_lock (&watched_lock);
 
 	for (l = watched_connections; l != NULL; l = next) {
 		next = l->next;
@@ -52,17 +52,14 @@
 			g_object_ref (cl);
 			g_signal_emit (cl, comp_listener_signals[COMPONENT_DIED], 0);
 			cl->priv->component = CORBA_OBJECT_NIL;
-			/* because the finalize method uses the lock too */
-			g_static_mutex_unlock (&watched_lock);
 			g_object_unref (cl);
-			g_static_mutex_lock (&watched_lock);
 			break;
 		default :
 			break;
 		}
 	}
 
-	g_static_mutex_unlock (&watched_lock);
+	g_static_rec_mutex_unlock (&watched_lock);
 }
 
 G_DEFINE_TYPE (EComponentListener, e_component_listener, G_TYPE_OBJECT);
@@ -100,9 +97,9 @@
 
 	g_return_if_fail (E_IS_COMPONENT_LISTENER (cl));
 
-	g_static_mutex_lock (&watched_lock);
+	g_static_rec_mutex_lock (&watched_lock);
 	watched_connections = g_list_remove (watched_connections, cl);
-	g_static_mutex_unlock (&watched_lock);
+	g_static_rec_mutex_unlock (&watched_lock);
 
 	if (cl->priv->component != CORBA_OBJECT_NIL)
 		cl->priv->component = CORBA_OBJECT_NIL;
@@ -131,7 +128,7 @@
 
 	g_return_val_if_fail (comp != NULL, NULL);
 
-	g_static_mutex_lock (&watched_lock);
+	g_static_rec_mutex_lock (&watched_lock);
 
 	cl = g_object_new (E_COMPONENT_LISTENER_TYPE, NULL);
 	cl->priv->component = comp;
@@ -140,7 +137,7 @@
 	ORBit_small_listen_for_broken (comp, G_CALLBACK (connection_listen_cb), cl);
 	watched_connections = g_list_prepend (watched_connections, cl);
 
-	g_static_mutex_unlock (&watched_lock);
+	g_static_rec_mutex_unlock (&watched_lock);
 
 	return cl;
 }



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