[evolution-patches] [calendar + gal] fix for #56271



Attached diff in evolution/calendar fixes crash occurring in gal, where we were freeing static strings passed from the calendar code. The second diff in gal/gal/e-table fixes freeze/unfreeze problem in e-table-item I run into while fixing #56271.

R.
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2436
diff -u -p -r1.2436 ChangeLog
--- ChangeLog	6 Jul 2004 15:10:16 -0000	1.2436
+++ ChangeLog	8 Jul 2004 15:02:08 -0000
@@ -1,3 +1,17 @@
+2004-07-08  Radek Doulik  <rodo ximian com>
+
+	* gui/e-cal-model.c (e_cal_model_date_value_to_string): as below
+
+	* gui/e-cal-model-calendar.c (ecmc_value_to_string): as below
+
+	* gui/e-cal-model.c (ecm_value_to_string): as below
+
+	* gui/e-cal-model-tasks.c (ecmt_value_to_string): dup the string
+	value, it's free-ed later. instead of returning NULL return
+	g_strdup ("") as gal does
+
+	Fixes #56271
+
 2004-07-06  Rodrigo Moya <rodrigo novell com>
 
 	* gui/gnome-cal.c (gnome_calendar_init): setup the widgets before
Index: gui/e-cal-model-calendar.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-calendar.c,v
retrieving revision 1.11
diff -u -p -r1.11 e-cal-model-calendar.c
--- gui/e-cal-model-calendar.c	7 May 2004 15:10:46 -0000	1.11
+++ gui/e-cal-model-calendar.c	8 Jul 2004 15:02:08 -0000
@@ -463,7 +463,7 @@ ecmc_value_is_empty (ETableModel *etm, i
 static char *
 ecmc_value_to_string (ETableModel *etm, int col, const void *value)
 {
-	g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_CALENDAR_FIELD_LAST, NULL);
+	g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_CALENDAR_FIELD_LAST, g_strdup (""));
 
 	if (col < E_CAL_MODEL_FIELD_LAST)
 		return E_TABLE_MODEL_CLASS (parent_class)->value_to_string (etm, col, value);
@@ -476,7 +476,7 @@ ecmc_value_to_string (ETableModel *etm, 
 		return g_strdup (value);
 	}
 
-	return NULL;
+	return g_strdup ("");
 }
 
 /* ECalModel class methods */
Index: gui/e-cal-model-tasks.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model-tasks.c,v
retrieving revision 1.23
diff -u -p -r1.23 e-cal-model-tasks.c
--- gui/e-cal-model-tasks.c	11 May 2004 14:29:34 -0000	1.23
+++ gui/e-cal-model-tasks.c	8 Jul 2004 15:02:08 -0000
@@ -992,8 +992,8 @@ ecmt_value_to_string (ETableModel *etm, 
 {
 	ECalModelTasks *model = (ECalModelTasks *) etm;
 
-	g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), NULL);
-	g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_TASKS_FIELD_LAST, NULL);
+	g_return_val_if_fail (E_IS_CAL_MODEL_TASKS (model), g_strdup (""));
+	g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_TASKS_FIELD_LAST, g_strdup (""));
 
 	if (col < E_CAL_MODEL_FIELD_LAST)
 		return E_TABLE_MODEL_CLASS (parent_class)->value_to_string (etm, col, value);
@@ -1009,7 +1009,7 @@ ecmt_value_to_string (ETableModel *etm, 
 		return e_cal_model_date_value_to_string (E_CAL_MODEL (model), value);
 	case E_CAL_MODEL_TASKS_FIELD_COMPLETE :
 	case E_CAL_MODEL_TASKS_FIELD_OVERDUE :
-		return value ? _("Yes") : _("No");
+		return g_strdup (value ? _("Yes") : _("No"));
 	case E_CAL_MODEL_TASKS_FIELD_PERCENT :
 		if (GPOINTER_TO_INT (value) < 0)
 			return g_strdup ("N/A");
@@ -1017,7 +1017,7 @@ ecmt_value_to_string (ETableModel *etm, 
 			return g_strdup_printf ("%i%%", GPOINTER_TO_INT (value));
 	}
 
-	return NULL;
+	return g_strdup ("");
 }
 
 /* ECalModel class methods */
Index: gui/e-cal-model.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-cal-model.c,v
retrieving revision 1.36
diff -u -p -r1.36 e-cal-model.c
--- gui/e-cal-model.c	11 Jun 2004 15:55:14 -0000	1.36
+++ gui/e-cal-model.c	8 Jul 2004 15:02:08 -0000
@@ -894,7 +894,7 @@ ecm_value_is_empty (ETableModel *etm, in
 static char *
 ecm_value_to_string (ETableModel *etm, int col, const void *value)
 {
-	g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_FIELD_LAST, NULL);
+	g_return_val_if_fail (col >= 0 && col < E_CAL_MODEL_FIELD_LAST, g_strdup (""));
 
 	switch (col) {
 	case E_CAL_MODEL_FIELD_CATEGORIES :
@@ -906,19 +906,19 @@ ecm_value_to_string (ETableModel *etm, i
 		return e_cal_model_date_value_to_string (E_CAL_MODEL (etm), value);
 	case E_CAL_MODEL_FIELD_ICON :
 		if (GPOINTER_TO_INT (value) == 0)
-			return _("Normal");
+			return g_strdup (_("Normal"));
 		else if (GPOINTER_TO_INT (value) == 1)
-			return _("Recurring");
+			return g_strdup (_("Recurring"));
 		else
-			return _("Assigned");
+			return g_strdup (_("Assigned"));
 	case E_CAL_MODEL_FIELD_HAS_ALARMS :
-		return value ? _("Yes") : _("No");
+		return g_strdup (value ? _("Yes") : _("No"));
 	case E_CAL_MODEL_FIELD_COLOR :
 	case E_CAL_MODEL_FIELD_COMPONENT :
-		return NULL;
+		return g_strdup ("");
 	}
 
-	return NULL;
+	return g_strdup ("");
 }
 
 /* ECalModel class methods */
@@ -1787,7 +1787,7 @@ e_cal_model_date_value_to_string (ECalMo
 	struct tm tmp_tm;
 	char buffer[64];
 
-	g_return_val_if_fail (E_IS_CAL_MODEL (model), NULL);
+	g_return_val_if_fail (E_IS_CAL_MODEL (model), g_strdup (""));
 
 	priv = model->priv;
 
Index: e-table/ChangeLog
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/ChangeLog,v
retrieving revision 1.936
diff -u -p -r1.936 ChangeLog
--- e-table/ChangeLog	22 Jun 2004 21:25:59 -0000	1.936
+++ e-table/ChangeLog	8 Jul 2004 15:01:27 -0000
@@ -1,3 +1,10 @@
+2004-07-07  Radek Doulik  <rodo ximian com>
+
+	* e-table-sorted-variable.c (etsv_add): added
+	e_table_model_pre_change because we call
+	e_table_model_row_inserted later. It fixes freeze/unfreeze for
+	ETableItem assert warning which I run into when fixing #56271
+
 2004-06-22  Rodney Dawes  <dobey novell com>
 
 	* e-table-config.c (do_fields_config_dialog, e_table_config_new):
Index: e-table/e-table-sorted-variable.c
===================================================================
RCS file: /cvs/gnome/gal/gal/e-table/e-table-sorted-variable.c,v
retrieving revision 1.36
diff -u -p -r1.36 e-table-sorted-variable.c
--- e-table/e-table-sorted-variable.c	6 Nov 2002 00:07:08 -0000	1.36
+++ e-table/e-table-sorted-variable.c	8 Jul 2004 15:01:27 -0000
@@ -128,6 +128,8 @@ etsv_add       (ETableSubsetVariable *et
 	ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv);
 	int i;
 
+	e_table_model_pre_change (etm);
+
 	if (etss->n_map + 1 > etssv->n_vals_allocated) {
 		etssv->n_vals_allocated += INCREMENT_AMOUNT;
 		etss->map_table = g_realloc (etss->map_table, (etssv->n_vals_allocated) * sizeof(int));


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