Fix for bug #578210
authorJedy Wang <jedy.wang@sun.com>
Tue, 21 Apr 2009 06:23:22 +0000 (14:23 +0800)
committerjedy <jedy@pampas.(none)>
Tue, 21 Apr 2009 06:32:25 +0000 (14:32 +0800)
ChangeLog
libedataserver/e-component-listener.c

index 4dda332..cb708ce 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2009-04-21  Wang Xin  <jedy.wang@sun.com>
+
+       ** Fix for bug #578210
+
+       * libedataserver/e-component-listener.c: (connection_listen_cb): Updated
+       the code to handle re-entrant problem.
+
 2009-04-12  Matthew Barnes  <mbarnes@redhat.com>
 
        ** Remove a bunch of juvenile comments.  Source code should
index 3dc0b59..00bd173 100644 (file)
@@ -36,18 +36,17 @@ static guint comp_listener_signals[LAST_SIGNAL];
 static void
 connection_listen_cb (gpointer object, gpointer user_data)
 {
-       GList *l, *next = NULL;
        EComponentListener *cl;
 
        g_static_rec_mutex_lock (&watched_lock);
 
-       for (l = watched_connections; l != NULL; l = next) {
-               next = l->next;
-               cl = l->data;
-
-               switch (ORBit_small_get_connection_status (cl->priv->component)) {
+       cl = (EComponentListener *)user_data;
+       /* cl can be removed in e_component_listener_finalize */
+       if (g_list_find (watched_connections, cl) == NULL)
+               g_static_rec_mutex_unlock (&watched_lock);
+       switch (ORBit_small_get_connection_status (cl->priv->component)) {
                case ORBIT_CONNECTION_DISCONNECTED :
-                       watched_connections = g_list_delete_link (watched_connections, l);
+                       watched_connections = g_list_remove (watched_connections, cl);
 
                        g_object_ref (cl);
                        g_signal_emit (cl, comp_listener_signals[COMPONENT_DIED], 0);
@@ -56,7 +55,6 @@ connection_listen_cb (gpointer object, gpointer user_data)
                        break;
                default :
                        break;
-               }
        }
 
        g_static_rec_mutex_unlock (&watched_lock);