[evolution/evolution-3-12] Fix regressions after commit d99f7bb7857



commit 4de22b3835da34e125a0df87dd62135b38c1a831
Author: Milan Crha <mcrha redhat com>
Date:   Mon Apr 28 16:06:53 2014 +0200

    Fix regressions after commit d99f7bb7857
    
    The commit fixed few memory leaks, but also caused several crashes
    due to those changes, thus this fixes the introduces issues.

 .../gui/widgets/e-addressbook-table-adapter.c      |    2 +-
 calendar/gui/e-alarm-list.c                        |    6 +++---
 calendar/gui/e-cal-model-calendar.c                |    2 --
 calendar/gui/e-cal-model-tasks.c                   |    4 +---
 calendar/gui/e-cal-model.c                         |   20 +++++++-------------
 e-util/e-table-one.c                               |    2 ++
 e-util/gal-a11y-e-table-item.c                     |    6 +++---
 7 files changed, 17 insertions(+), 25 deletions(-)
---
diff --git a/addressbook/gui/widgets/e-addressbook-table-adapter.c 
b/addressbook/gui/widgets/e-addressbook-table-adapter.c
index 2e4a85a..87a0dee 100644
--- a/addressbook/gui/widgets/e-addressbook-table-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-table-adapter.c
@@ -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. */
diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c
index 77f8c72..19b47e0 100644
--- a/calendar/gui/e-alarm-list.c
+++ b/calendar/gui/e-alarm-list.c
@@ -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
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 86bc470..b3099cd 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -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;
        }
 }
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index e4737ad..f07d9bf 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -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 :
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index e702719..a27bef9 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -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)
diff --git a/e-util/e-table-one.c b/e-util/e-table-one.c
index 5d8f104..96082df 100644
--- a/e-util/e-table-one.c
+++ b/e-util/e-table-one.c
@@ -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
diff --git a/e-util/gal-a11y-e-table-item.c b/e-util/gal-a11y-e-table-item.c
index e3a842a..95b4894 100644
--- a/e-util/gal-a11y-e-table-item.c
+++ b/e-util/gal-a11y-e-table-item.c
@@ -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++) {


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