[evolution-patches] patch for #61273 (changes in e-source-group.c)



Hi,
The attached patch removes the signal handler registered (for CHANGED
singal of ESource) on Esource object by ESourceGroup when the ESource
group object is removed from ESourceGroup object. 
	There is a problem if we do not do this, when somebody removes a
ESource object from group but does not unref the ESource object. This
ESource Object gets a weak_ref notification (group_weak_notify) when
EsourceGroup object is being disposed. group_weak_notify emits CHANGED
signal on source, resulting in call to source_changed_callback (in
e-source-group.c) which emits signal on group which is just being
disposed thus resulting in crash. I could not find out  though  where in
evolution code  ESource object is removed from group but not cleaned up,
but this patch solves the crash.

Hope my understanding is correct :)

Interestingly  this crash happens with snaps but not with evolution
which i have built from sources. The different versions of GLib is
making the difference i guess. Version in Gobject.pc from snaps is 2.2.3
and what i have from sources is 2.4.0

Thanks,
Siva
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/ChangeLog,v
retrieving revision 1.139
diff -u -r1.139 ChangeLog
--- ChangeLog	12 Jul 2004 18:16:04 -0000	1.139
+++ ChangeLog	16 Jul 2004 07:10:58 -0000
@@ -1,3 +1,11 @@
+2004-07-16  Sivaiah Nallagatla <snallagatla novell com>
+
+	* libedataserver/e-source-group.c (e_source_group_remove_source)
+	(e_source_group_remove_source) : disconnet the signal 
+	handler registered on source object for CHANGED singal
+	as we may not be interested in the changes in source once
+	it is removed form the group
+
 2004-07-12  Chris Toshok  <toshok ximian com>
 
 	[ most likely fixes #57999 ]
Index: libedataserver/e-source-group.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/libedataserver/e-source-group.c,v
retrieving revision 1.6
diff -u -r1.6 e-source-group.c
--- libedataserver/e-source-group.c	16 Jun 2004 05:43:21 -0000	1.6
+++ libedataserver/e-source-group.c	16 Jul 2004 07:10:58 -0000
@@ -615,6 +615,9 @@
 	for (p = group->priv->sources; p != NULL; p = p->next) {
 		if (E_SOURCE (p->data) == source) {
 			group->priv->sources = g_slist_remove_link (group->priv->sources, p);
+			g_signal_handlers_disconnect_by_func (source,
+							      G_CALLBACK (source_changed_callback),
+							      group);
 			g_signal_emit (group, signals[SOURCE_REMOVED], 0, source);
 			g_signal_emit (group, signals[CHANGED], 0);
 			return TRUE;
@@ -641,6 +644,9 @@
 
 		if (strcmp (e_source_peek_uid (source), uid) == 0) {
 			group->priv->sources = g_slist_remove_link (group->priv->sources, p);
+			g_signal_handlers_disconnect_by_func (source,
+							      G_CALLBACK (source_changed_callback),
+							      group);
 			g_signal_emit (group, signals[SOURCE_REMOVED], 0, source);
 			g_signal_emit (group, signals[CHANGED], 0);
 			return TRUE;


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