Re: [evolution-patches] 66344 Crash adding Start Date Field to tasks



On Thu, 2004-09-23 at 09:05 -0400, JP Rosevear wrote:
> On Wed, 2004-09-22 at 23:16 +0200, Rodrigo Moya wrote:
> > On Wed, 2004-09-22 at 14:43 -0400, JP Rosevear wrote:
> > > With a bogus start date, we would crash because struct tm was empty
> > > during strftime.  Fixed end date, completed and due while I was at it
> > > too.
> > > 
> > looks good
> 
> Realized the patch I sent didn't include all the changes, new patch
> attached.

Let me try this one more time.

-JP
-- 
JP Rosevear <jpr novell com>
Novell, Inc.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2500.2.12
diff -u -p -r1.2500.2.12 ChangeLog
--- ChangeLog	23 Sep 2004 13:09:52 -0000	1.2500.2.12
+++ ChangeLog	23 Sep 2004 13:11:53 -0000
@@ -1,4 +1,16 @@
 2004-09-22  JP Rosevear  <jpr novell com>
+ 
+ 	Fixes #66344
+ 
+ 	* gui/e-cal-model-calendar.c (get_dtend): check for existence of
+ 	property and null time instead of sending through bad data
+ 
+ 	* gui/e-cal-model.c (get_dtstart): ditto
+ 
+ 	* gui/e-cal-model-tasks.c (get_completed): ditto
+ 	(get_due): ditto
+
+2004-09-22  JP Rosevear  <jpr novell com>
 
 	* gui/calendar-component.c (fill_popup_menu_cb): ditto
 
Index: gui/e-cal-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.c,v
retrieving revision 1.44
diff -u -p -r1.44 e-cal-model.c
--- gui/e-cal-model.c	17 Aug 2004 13:35:28 -0000	1.44
+++ gui/e-cal-model.c	23 Sep 2004 13:11:53 -0000
@@ -401,10 +401,16 @@ get_dtstart (ECalModel *model, ECalModel
 	priv = model->priv;
 
 	if (!comp_data->dtstart) {
+		icalproperty *prop;
 		icaltimezone *zone;
 		gboolean got_zone = FALSE;
 
-		tt_start = icalcomponent_get_dtstart (comp_data->icalcomp);
+		prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTSTART_PROPERTY);
+		if (!prop)
+			return NULL;
+
+		tt_start = icalproperty_get_dtstart (prop);
+
 		if (icaltime_get_tzid (tt_start)
 		    && e_cal_get_timezone (comp_data->client, icaltime_get_tzid (tt_start), &zone, NULL))
 			got_zone = TRUE;
@@ -417,7 +423,7 @@ get_dtstart (ECalModel *model, ECalModel
 				tt_start = icaltime_from_timet (comp_data->instance_start, tt_start.is_date);
 		}
 
-		if (!icaltime_is_valid_time (tt_start))
+		if (!icaltime_is_valid_time (tt_start) || icaltime_is_null_time (tt_start))
 			return NULL;
 
 		comp_data->dtstart = g_new0 (ECellDateEditValue, 1);
Index: gui/e-cal-model-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-calendar.c,v
retrieving revision 1.13.6.1
diff -u -p -r1.13.6.1 e-cal-model-calendar.c
--- gui/e-cal-model-calendar.c	21 Sep 2004 16:01:19 -0000	1.13.6.1
+++ gui/e-cal-model-calendar.c	23 Sep 2004 13:11:53 -0000
@@ -112,20 +112,26 @@ ecmc_column_count (ETableModel *etm)
 }
 
 static ECellDateEditValue *
-get_dtend (ECalModel *model, ECalModelComponent *comp_data)
+get_dtend (ECalModelCalendar *model, ECalModelComponent *comp_data)
 {
 	struct icaltimetype tt_end;
 
 	if (!comp_data->dtend) {
+		icalproperty *prop;
 		icaltimezone *zone;
 		gboolean got_zone = FALSE;
 
-		tt_end = icalcomponent_get_dtend (comp_data->icalcomp);
+		prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DTEND_PROPERTY);
+		if (!prop)
+			return NULL;
+
+		tt_end = icalproperty_get_dtend (prop);
+
 		if (icaltime_get_tzid (tt_end)
 		    && e_cal_get_timezone (comp_data->client, icaltime_get_tzid (tt_end), &zone, NULL))
 			got_zone = TRUE;
 
-		if ((e_cal_model_get_flags (model) & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES) &&
+		if ((e_cal_model_get_flags (E_CAL_MODEL (model)) & E_CAL_MODEL_FLAGS_EXPAND_RECURRENCES) &&
 		    (e_cal_util_component_has_recurrences (comp_data->icalcomp))) {
 			if (got_zone)
 				tt_end = icaltime_from_timet_with_zone (comp_data->instance_end, tt_end.is_date, zone);
@@ -133,7 +139,7 @@ get_dtend (ECalModel *model, ECalModelCo
 				tt_end = icaltime_from_timet (comp_data->instance_end, tt_end.is_date);
 		}
 
-		if (!icaltime_is_valid_time (tt_end))
+		if (!icaltime_is_valid_time (tt_end) || icaltime_is_null_time (tt_end))
 			return NULL;
 
 		comp_data->dtend = g_new0 (ECellDateEditValue, 1);
Index: gui/e-cal-model-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-tasks.c,v
retrieving revision 1.24.6.2
diff -u -p -r1.24.6.2 e-cal-model-tasks.c
--- gui/e-cal-model-tasks.c	21 Sep 2004 16:09:05 -0000	1.24.6.2
+++ gui/e-cal-model-tasks.c	23 Sep 2004 13:11:53 -0000
@@ -242,7 +242,7 @@ get_completed (ECalModelComponent *comp_
 			return NULL;
 
 		tt_completed = icalproperty_get_completed (prop);
-		if (!icaltime_is_valid_time (tt_completed))
+		if (!icaltime_is_valid_time (tt_completed) || icaltime_is_null_time (tt_completed))
 			return NULL;
 
 		comp_data->completed = g_new0 (ECellDateEditValue, 1);
@@ -272,7 +272,7 @@ get_due (ECalModelComponent *comp_data)
 			return NULL;
 
 		tt_due = icalproperty_get_due (prop);
-		if (!icaltime_is_valid_time (tt_due))
+		if (!icaltime_is_valid_time (tt_due) || icaltime_is_null_time (tt_due))
 			return NULL;
 
 		comp_data->due = g_new0 (ECellDateEditValue, 1);


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