[evolution-patches] fixes crash in GW calendar backend



The attached patch fixes the crash at #55719, not sure yet why 'cnc' is
being NULL there, but this makes sure we don't call EGwConnection's
methods while offline.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/ChangeLog,v
retrieving revision 1.207
diff -u -p -r1.207 ChangeLog
--- ChangeLog	16 Mar 2004 16:29:47 -0000	1.207
+++ ChangeLog	17 Mar 2004 19:05:36 -0000
@@ -1,3 +1,12 @@
+2004-03-17  Rodrigo Moya <rodrigo ximian com>
+
+	Fixes #55719
+
+	* backends/groupwise/e-cal-backend-groupwise.c
+	(e_cal_backend_groupwise_get_cal_address): deal with online/offline
+	modes.
+	(e_cal_backend_groupwise_finalize): free new private field.
+
 2004-03-16 Harish K <kharish novell com>
 
 	* libecal/e-cal.c : Move open_calendar call into async_idle_cb
Index: backends/groupwise/e-cal-backend-groupwise.c
===================================================================
RCS file: /cvs/gnome/evolution-data-server/calendar/backends/groupwise/e-cal-backend-groupwise.c,v
retrieving revision 1.50
diff -u -p -r1.50 e-cal-backend-groupwise.c
--- backends/groupwise/e-cal-backend-groupwise.c	15 Mar 2004 03:53:42 -0000	1.50
+++ backends/groupwise/e-cal-backend-groupwise.c	17 Mar 2004 19:05:37 -0000
@@ -51,6 +51,9 @@ struct _ECalBackendGroupwisePrivate {
 	char *container_id;
 	CalMode mode;
 	icaltimezone *default_zone;
+
+	/* fields for storing info while offline */
+	char *user_email;
 };
 
 static void e_cal_backend_groupwise_dispose (GObject *object);
@@ -158,6 +161,7 @@ get_deltas (gpointer handle)
 				g_message ("Could not add the component");
 		}
 	}	
+
 	if (updates) {
 		for (l = updates; l != NULL; l = g_slist_next (l)) {
 			EGwItem *item = (EGwItem *) l->data;
@@ -171,6 +175,7 @@ get_deltas (gpointer handle)
 				
 		}
 	}
+
         return E_GW_CONNECTION_STATUS_OK;        
 }
 
@@ -303,6 +308,11 @@ e_cal_backend_groupwise_finalize (GObjec
 		priv->container_id = NULL;
 	}
 
+	if (priv->user_email) {
+		g_free (priv->user_email);
+		priv->user_email = NULL;
+	}
+
 	g_free (priv);
 	cbgw->priv = NULL;
 
@@ -329,9 +339,19 @@ static ECalBackendSyncStatus
 e_cal_backend_groupwise_get_cal_address (ECalBackendSync *backend, EDataCal *cal, char **address)
 {
 	ECalBackendGroupwise *cbgw;
+	ECalBackendGroupwisePrivate *priv;
 	
 	cbgw = E_CAL_BACKEND_GROUPWISE(backend);
-	*address = g_strdup (e_gw_connection_get_user_email (cbgw->priv->cnc));
+	priv = cbgw->priv;
+
+	if (priv->mode == CAL_MODE_REMOTE) {
+		if (priv->user_email)
+			g_free (priv->user_email);
+
+		priv->user_email = g_strdup (e_gw_connection_get_user_email (cbgw->priv->cnc));
+	}
+
+	*address = g_strdup (priv->user_email);
 	
 	return GNOME_Evolution_Calendar_Success;
 }
@@ -696,7 +716,7 @@ e_cal_backend_groupwise_start_query (ECa
 /* Get_free_busy handler for the file backend */
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_get_free_busy (ECalBackendSync *backend, EDataCal *cal, GList *users,
-				time_t start, time_t end, GList **freebusy)
+				       time_t start, time_t end, GList **freebusy)
 {
        EGwConnectionStatus status;
        ECalBackendGroupwise *cbgw;
@@ -711,8 +731,7 @@ e_cal_backend_groupwise_get_free_busy (E
        return GNOME_Evolution_Calendar_Success; 
 }
 
-typedef struct 
-{
+typedef struct {
 	ECalBackendGroupwise *backend;
 	icalcomponent_kind kind;
 	GList *deletes;
@@ -742,7 +761,7 @@ e_cal_backend_groupwise_compute_changes_
 
 static ECalBackendSyncStatus
 e_cal_backend_groupwise_compute_changes (ECalBackendGroupwise *cbgw, const char *change_id,
-				  GList **adds, GList **modifies, GList **deletes)
+					 GList **adds, GList **modifies, GList **deletes)
 {
         ECalBackendSyncStatus status;
 	ECalBackendCache *cache;


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