[evolution-patches] patch for #60735 Calendar



Hi,
When a gconf-entry of a selected task group is removed from gconf
(either manually or programatically) evolution crashes .
This is because e-taks.c stores/looks up the ECal objects in
priv->clients hashtable based on the uri from e_source_get_uri. But
e_source_get_uri returns NULL, when the source_group under which this
e-source falls goes NULL. The attached patch uses the ESource uid as the
key into priv->clients instead of uri. This is how things done in
gnome-cal.c also

Thanks,
Siva

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2429
diff -u -r1.2429 ChangeLog
--- ChangeLog	25 Jun 2004 17:39:26 -0000	1.2429
+++ ChangeLog	26 Jun 2004 10:49:36 -0000
@@ -1,3 +1,9 @@
+2004-06-25  Sivaiah Nallagatla <snallagatla novell com>
+
+        * gui/e-tasks.c (e_tasks_add_todo_source)
+         (e_tasks_remove_todo_source) : store and lookup  clients
+        based on ESource uid instead of uri in priv->clients
+
 2004-06-25  JP Rosevear  <jpr novell com>
 
 	* gui/dialogs/alarm-dialog.glade: don't show option tabs
Index: gui/e-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-tasks.c,v
retrieving revision 1.97
diff -u -r1.97 e-tasks.c
--- gui/e-tasks.c	7 Jun 2004 14:11:44 -0000	1.97
+++ gui/e-tasks.c	26 Jun 2004 10:49:37 -0000
@@ -826,6 +826,7 @@
 	ECal *client;
 	char *str_uri;
 	GError *error = NULL;
+	const char *uid;
 
 	g_return_val_if_fail (tasks != NULL, FALSE);
 	g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
@@ -833,15 +834,15 @@
 
 	priv = tasks->priv;
 
-	str_uri = e_source_get_uri (source);
-	client = g_hash_table_lookup (priv->clients, str_uri);
-	if (client) {
-		g_free (str_uri);
+	uid = e_source_peek_uid (source);
+	client = g_hash_table_lookup (priv->clients, uid);
+	if (client) 
 		return TRUE;
-	}
+	
 
 	/* FIXME Loading should be async */
 	/* FIXME With no event handling here the status message never actually changes */
+	str_uri = e_source_get_uri (source);
 	set_status_message (tasks, _("Opening tasks at %s"), str_uri);
 
 	client = auth_new_cal_from_source (source, E_CAL_SOURCE_TYPE_TODO);
@@ -850,7 +851,7 @@
 		return FALSE;
 	}
 
-	g_hash_table_insert (priv->clients, str_uri, client);
+	g_hash_table_insert (priv->clients, g_strdup (uid) , client);
 	priv->clients_list = g_list_prepend (priv->clients_list, client);
 	
 	g_signal_connect (G_OBJECT (client), "backend_error", G_CALLBACK (backend_error_cb), tasks);
@@ -871,7 +872,7 @@
 	ETasksPrivate *priv;
 	ECal *client;
 	ECalModel *model;
-	char *str_uri;
+	const char *uid;
 
 	g_return_val_if_fail (tasks != NULL, FALSE);
 	g_return_val_if_fail (E_IS_TASKS (tasks), FALSE);
@@ -879,12 +880,11 @@
 
 	priv = tasks->priv;
 
-	str_uri = e_source_get_uri (source);
-	client = g_hash_table_lookup (priv->clients, str_uri);
-	if (!client) {
-		g_free (str_uri);
+	uid = e_source_peek_uid (source);
+	client = g_hash_table_lookup (priv->clients, uid);
+	if (!client) 
 		return TRUE;
-	}
+	
 
 	priv->clients_list = g_list_remove (priv->clients_list, client);
 	g_signal_handlers_disconnect_matched (client, G_SIGNAL_MATCH_DATA,
@@ -893,8 +893,8 @@
 	model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
 	e_cal_model_remove_client (model, client);
 
-	g_hash_table_remove (priv->clients, str_uri);
-	g_free (str_uri);
+	g_hash_table_remove (priv->clients, uid);
+       
 
 	gtk_signal_emit (GTK_OBJECT (tasks), e_tasks_signals[SOURCE_REMOVED], source);
 


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