Commit 43a4b38f authored by Milan Crha's avatar Milan Crha

Fix regressions after commit fdde3339

The commit fixed few memory leaks, but also caused several crashes
due to those changes, thus this fixes the introduces issues.
parent 9922d3a0
......@@ -189,7 +189,7 @@ addressbook_value_at (ETableModel *etc,
}
}
return (gpointer)(value ? value : "");
return g_strdup (value ? value : "");
}
/* This function sets the value at a particular point in our ETableModel. */
......
......@@ -78,11 +78,11 @@ G_DEFINE_TYPE_WITH_CODE (
e_alarm_list_tree_model_init))
static void
alarm_list_finalize (GObject *object)
alarm_list_dispose (GObject *object)
{
e_alarm_list_clear (E_ALARM_LIST (object));
G_OBJECT_CLASS (e_alarm_list_parent_class)->finalize (object);
G_OBJECT_CLASS (e_alarm_list_parent_class)->dispose (object);
}
static void
......@@ -93,7 +93,7 @@ e_alarm_list_class_init (EAlarmListClass *class)
column_types[E_ALARM_LIST_COLUMN_DESCRIPTION] = G_TYPE_STRING;
object_class = G_OBJECT_CLASS (class);
object_class->finalize = alarm_list_finalize;
object_class->dispose = alarm_list_dispose;
}
static void
......
......@@ -434,8 +434,6 @@ cal_model_calendar_free_value (ETableModel *etm,
case E_CAL_MODEL_CALENDAR_FIELD_DTEND :
case E_CAL_MODEL_CALENDAR_FIELD_LOCATION :
case E_CAL_MODEL_CALENDAR_FIELD_TRANSPARENCY :
if (value)
g_free (value);
break;
}
}
......
......@@ -1066,8 +1066,6 @@ cal_model_tasks_free_value (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
if (value)
g_free (value);
break;
case E_CAL_MODEL_TASKS_FIELD_PERCENT :
case E_CAL_MODEL_TASKS_FIELD_COMPLETE :
......@@ -1093,7 +1091,7 @@ cal_model_tasks_initialize_value (ETableModel *etm,
case E_CAL_MODEL_TASKS_FIELD_PRIORITY :
case E_CAL_MODEL_TASKS_FIELD_STATUS :
case E_CAL_MODEL_TASKS_FIELD_URL :
return g_strdup ("");
return (gpointer) "";
case E_CAL_MODEL_TASKS_FIELD_COMPLETED :
case E_CAL_MODEL_TASKS_FIELD_DUE :
case E_CAL_MODEL_TASKS_FIELD_COMPLETE :
......
......@@ -438,7 +438,7 @@ get_categories (ECalModelComponent *comp_data)
}
}
return comp_data->priv->categories_str->str;
return g_strdup (comp_data->priv->categories_str->str);
}
static gchar *
......@@ -480,24 +480,18 @@ static gpointer
get_description (ECalModelComponent *comp_data)
{
icalproperty *prop;
static GString *str = NULL;
if (str) {
g_string_free (str, TRUE);
str = NULL;
}
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_DESCRIPTION_PROPERTY);
if (prop) {
str = g_string_new (NULL);
GString *str = g_string_new (NULL);
do {
str = g_string_append (str, icalproperty_get_description (prop));
} while ((prop = icalcomponent_get_next_property (comp_data->icalcomp, ICAL_DESCRIPTION_PROPERTY)));
return str->str;
return g_string_free (str, FALSE);
}
return (gpointer) "";
return g_strdup ("");
}
static ECellDateEditValue *
......@@ -597,9 +591,9 @@ get_summary (ECalModelComponent *comp_data)
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_SUMMARY_PROPERTY);
if (prop)
return (gpointer) icalproperty_get_summary (prop);
return g_strdup (icalproperty_get_summary (prop));
return (gpointer) "";
return g_strdup ("");
}
static gchar *
......@@ -1554,8 +1548,8 @@ cal_model_free_value (ETableModel *etm,
case E_CAL_MODEL_FIELD_HAS_ALARMS :
case E_CAL_MODEL_FIELD_ICON :
case E_CAL_MODEL_FIELD_COLOR :
case E_CAL_MODEL_FIELD_DTSTART:
break;
case E_CAL_MODEL_FIELD_DTSTART :
case E_CAL_MODEL_FIELD_CREATED :
case E_CAL_MODEL_FIELD_LASTMODIFIED :
if (value)
......
......@@ -144,6 +144,8 @@ table_one_free_value (ETableModel *etm,
if (one->source)
e_table_model_free_value (one->source, col, value);
if (one->data)
one->data[col] = one->source ? e_table_model_initialize_value (one->source, col) : NULL;
}
static gpointer
......
......@@ -875,9 +875,9 @@ eti_header_structure_changed (ETableHeader *eth,
g_return_if_fail (cols && prev_cols && n_cols > 0);
/* Init to ETI_HEADER_UNCHANGED. */
state = g_malloc0 (sizeof (gint) * n_cols);
prev_state = g_malloc0 (sizeof (gint) * prev_n_cols);
reorder = g_malloc0 (sizeof (gint) * n_cols);
state = g_malloc0 (sizeof (gint) * (MAX (prev_n_cols, n_cols) + 1));
prev_state = g_malloc0 (sizeof (gint) * (MAX (prev_n_cols, n_cols) + 1));
reorder = g_malloc0 (sizeof (gint) * (MAX (prev_n_cols, n_cols) + 1));
/* Compare with previously saved column headers. */
for (i = 0; i < n_cols && cols[i]; i++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment