Re: [evolution-patches] Re: Exchange connector: Fix for 72041



Attached the patch with these changes..
Please review.

Thanks,
Sushma.

On Thu, 2005-03-10 at 11:15 +0530, Sarfraaz Ahmed wrote:
> On second thoughts, i think it would be more cleaner if you could use
> a local variable, comp_uid or some such, and finally dup it as
> return_uid at the end, once the object is successfully created on the
> server. That way you wont be returning the uid, in any fail case.
> 
> -- Sarfraaz
> 
> On Thu, 2005-03-10 at 10:52 +0530, Sarfraaz Ahmed wrote:
> > This looks fine, with one small change below. While you are at it,
> > can you also fix this same problem in calendar as well?
> > 
> > Thanks
> > -- Sarfraaz
> > 
> > On Wed, 2005-03-09 at 19:19 +0530, Sushma Rai wrote:  
> > > Hi,
> > > 
> > > This is the patch for crash during creation of tasks.
> > > Please review.
> > > 
> > > Thanks,
> > > Sushma.
> > > text/plain attachment (task-crash.diff)
> > > Index: calendar/e-cal-backend-exchange-tasks.c
> > > ===================================================================
> > > RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-tasks.c,v
> > > retrieving revision 1.13
> > > diff -u -p -r1.13 e-cal-backend-exchange-tasks.c
> > > --- calendar/e-cal-backend-exchange-tasks.c	18 Jan 2005 11:56:08 -0000	1.13
> > > +++ calendar/e-cal-backend-exchange-tasks.c	9 Mar 2005 13:39:04 -0000
> > > @@ -838,7 +838,7 @@ struct _cb_data {
> > >  
> > >  static ECalBackendSyncStatus
> > >  create_task_object (ECalBackendSync *backend, EDataCal *cal,
> > > -		    char **calobj, char **comp_uid)
> > > +		    char **calobj, char **return_uid)
> > >  {
> > >  	ECalBackendExchangeTasks *ecalbextask;
> > >  	ECalBackendExchange *ecalbex;
> > > @@ -882,8 +882,14 @@ create_task_object (ECalBackendSync *bac
> > >  
> > >  	modtime = e2k_timestamp_from_icaltime (current);
> > >  
> > > +	/* Get the uid */
> > > +       *return_uid = icalcomponent_get_uid (icalcomp);
> > You will have to dup this uid string.  
> > > +	if (!*return_uid) 
> > > +		return GNOME_Evolution_Calendar_InvalidObject;
> > > +
> > 
Index: calendar/e-cal-backend-exchange-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-tasks.c,v
retrieving revision 1.13
diff -u -r1.13 e-cal-backend-exchange-tasks.c
--- calendar/e-cal-backend-exchange-tasks.c	18 Jan 2005 11:56:08 -0000	1.13
+++ calendar/e-cal-backend-exchange-tasks.c	10 Mar 2005 07:54:30 -0000
@@ -838,7 +838,7 @@
 
 static ECalBackendSyncStatus
 create_task_object (ECalBackendSync *backend, EDataCal *cal,
-		    char **calobj, char **comp_uid)
+		    char **calobj, char **return_uid)
 {
 	ECalBackendExchangeTasks *ecalbextask;
 	ECalBackendExchange *ecalbex;
@@ -853,6 +853,7 @@
 	char * modtime;
 	char *location;
 	ECalBackendSyncStatus status;
+	const char *temp_comp_uid;
 
 	ecalbextask = E_CAL_BACKEND_EXCHANGE_TASKS (backend);
 	ecalbex = E_CAL_BACKEND_EXCHANGE (backend);
@@ -882,8 +883,14 @@
 
 	modtime = e2k_timestamp_from_icaltime (current);
 
+	/* Get the uid */
+	temp_comp_uid = icalcomponent_get_uid (icalcomp);
+	if (!temp_comp_uid) 
+		return GNOME_Evolution_Calendar_InvalidObject;
+
 	/* check if the object is already present in our cache */
-	if (e_cal_backend_exchange_in_cache (E_CAL_BACKEND_EXCHANGE (backend), *comp_uid, modtime, NULL)) {
+	if (e_cal_backend_exchange_in_cache (E_CAL_BACKEND_EXCHANGE (backend), 
+					     temp_comp_uid, modtime, NULL)) {
 		icalcomponent_free (icalcomp);
 		return GNOME_Evolution_Calendar_ObjectIdAlreadyExists;
 	}	
@@ -948,6 +955,7 @@
 		g_free (modtime);
 	}
 	
+       *return_uid = g_strdup (temp_comp_uid); 
 	return GNOME_Evolution_Calendar_Success;
 }
 
Index: calendar/e-cal-backend-exchange-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution-exchange/calendar/e-cal-backend-exchange-calendar.c,v
retrieving revision 1.36
diff -u -r1.36 e-cal-backend-exchange-calendar.c
--- calendar/e-cal-backend-exchange-calendar.c	26 Feb 2005 13:17:47 -0000	1.36
+++ calendar/e-cal-backend-exchange-calendar.c	10 Mar 2005 07:54:40 -0000
@@ -749,14 +749,13 @@
 	icalcomponent *icalcomp, *real_icalcomp;
 	icalcomponent_kind kind;
 	icalproperty *icalprop;
-	const char *comp_uid;
+	const char *temp_comp_uid;
 	char *busystatus, *insttype, *allday, *importance, *lastmod;
 	struct icaltimetype current, startt;
 	char *location, *ru_header;
 	ECalComponent *comp;
 	char *body, *body_crlf, *msg;
 	char *from, *date;
-	const char *x_name, *x_val;
 	const char *summary;
 	char *attach_body = NULL;
 	char *attach_body_crlf = NULL;
@@ -793,7 +792,7 @@
 		return GNOME_Evolution_Calendar_InvalidObject;
 	}
 	
-	comp_uid = icalcomponent_get_uid (icalcomp);
+	temp_comp_uid = icalcomponent_get_uid (icalcomp);
 	#if 0
 	if (lookup_component (E_CAL_BACKEND_EXCHANGE (cbexc), comp_uid))
 	{
@@ -975,7 +974,8 @@
 	g_free (lastmod);
 	g_free (location);
 	e2k_properties_free (props);
-	
+
+	*uid = g_strdup (temp_comp_uid);	
 	return GNOME_Evolution_Calendar_Success;
 }
 


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