evolution-data-server r8536 - in trunk: . libedataserver
- From: mcrha svn gnome org
- To: svn-commits-list gnome org
- Subject: evolution-data-server r8536 - in trunk: . libedataserver
- Date: Tue, 26 Feb 2008 14:41:57 +0000 (GMT)
Author: mcrha
Date: Tue Feb 26 14:41:57 2008
New Revision: 8536
URL: http://svn.gnome.org/viewvc/evolution-data-server?rev=8536&view=rev
Log:
2008-02-26 Milan Crha <mcrha redhat com>
** Fix for bug #475616
* libedataserver/e-component-listener.c: (connection_listen_cb),
(e_component_listener_finalize), (e_component_listener_new):
Guard global static variable with mutex lock.
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 Feb 26 14:41:57 2008
@@ -24,6 +24,7 @@
static void e_component_listener_finalize (GObject *object);
static GList *watched_connections = NULL;
+static GStaticMutex watched_lock = G_STATIC_MUTEX_INIT;
enum {
COMPONENT_DIED,
@@ -38,6 +39,8 @@
GList *l, *next = NULL;
EComponentListener *cl;
+ g_static_mutex_lock (&watched_lock);
+
for (l = watched_connections; l != NULL; l = next) {
next = l->next;
cl = l->data;
@@ -49,12 +52,17 @@
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_DEFINE_TYPE (EComponentListener, e_component_listener, G_TYPE_OBJECT);
@@ -92,7 +100,9 @@
g_return_if_fail (E_IS_COMPONENT_LISTENER (cl));
+ g_static_mutex_lock (&watched_lock);
watched_connections = g_list_remove (watched_connections, cl);
+ g_static_mutex_unlock (&watched_lock);
if (cl->priv->component != CORBA_OBJECT_NIL)
cl->priv->component = CORBA_OBJECT_NIL;
@@ -121,6 +131,8 @@
g_return_val_if_fail (comp != NULL, NULL);
+ g_static_mutex_lock (&watched_lock);
+
cl = g_object_new (E_COMPONENT_LISTENER_TYPE, NULL);
cl->priv->component = comp;
@@ -128,6 +140,8 @@
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);
+
return cl;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]