[evolution] Fix various memory leaks



commit fdde33396195d6287e9b582e7ffe8a3bff453e84
Author: Milan Crha <mcrha redhat com>
Date:   Thu Apr 24 18:58:34 2014 +0200

    Fix various memory leaks

 calendar/gui/dialogs/event-page.c    |    1 +
 calendar/gui/e-alarm-list.c          |   13 +++++++++++++
 calendar/gui/e-cal-model.c           |    2 +-
 calendar/gui/e-cell-date-edit-text.c |    2 ++
 calendar/gui/e-day-view.c            |    6 ++++++
 calendar/gui/e-meeting-list-view.c   |    2 ++
 e-util/e-cell-combo.c                |    6 ++++--
 e-util/e-cell-date-edit.c            |    6 ++++--
 e-util/e-cell-date.c                 |    2 ++
 e-util/e-cell-number.c               |    2 ++
 e-util/e-cell-percent.c              |    2 ++
 e-util/e-cell-size.c                 |    2 ++
 e-util/e-cell-text.c                 |   15 ++++++++++-----
 e-util/e-cell-text.h                 |    4 ++++
 e-util/e-web-view.c                  |    1 +
 e-util/gal-view-instance.c           |    5 ++++-
 mail/message-list.c                  |   24 ++++++++++++------------
 17 files changed, 72 insertions(+), 23 deletions(-)
---
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index e0a9c48..17bc6d4 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -938,6 +938,7 @@ event_page_finalize (GObject *object)
        g_ptr_array_free (priv->deleted_attendees, TRUE);
 
        g_free (priv->old_summary);
+       g_free (priv->user_add);
 
        priv->alarm_list_dlg_widget = NULL;
 
diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c
index 687e496..77f8c72 100644
--- a/calendar/gui/e-alarm-list.c
+++ b/calendar/gui/e-alarm-list.c
@@ -78,9 +78,22 @@ G_DEFINE_TYPE_WITH_CODE (
                e_alarm_list_tree_model_init))
 
 static void
+alarm_list_finalize (GObject *object)
+{
+       e_alarm_list_clear (E_ALARM_LIST (object));
+
+       G_OBJECT_CLASS (e_alarm_list_parent_class)->finalize (object);
+}
+
+static void
 e_alarm_list_class_init (EAlarmListClass *class)
 {
+       GObjectClass *object_class;
+
        column_types[E_ALARM_LIST_COLUMN_DESCRIPTION] = G_TYPE_STRING;
+
+       object_class = G_OBJECT_CLASS (class);
+       object_class->finalize = alarm_list_finalize;
 }
 
 static void
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index aff77fa..e702719 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -1133,7 +1133,7 @@ cal_model_finalize (GObject *object)
                }
                g_object_unref (comp_data);
        }
-       g_ptr_array_free (priv->objects, FALSE);
+       g_ptr_array_free (priv->objects, TRUE);
 
        g_mutex_clear (&priv->notify_lock);
 
diff --git a/calendar/gui/e-cell-date-edit-text.c b/calendar/gui/e-cell-date-edit-text.c
index 5ceca0b..1d13953 100644
--- a/calendar/gui/e-cell-date-edit-text.c
+++ b/calendar/gui/e-cell-date-edit-text.c
@@ -134,6 +134,8 @@ cell_date_edit_text_get_text (ECellText *cell,
 
 static void
 cell_date_edit_text_free_text (ECellText *cell,
+                              ETableModel *model,
+                              gint col,
                                gchar *text)
 {
        g_free (text);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 919f114..658f6d6 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -1146,6 +1146,12 @@ day_view_dispose (GObject *object)
        g_clear_object (&day_view->time_canvas);
        g_clear_object (&day_view->priv->model);
 
+       g_free (day_view->priv->marcus_bains_day_view_color);
+       day_view->priv->marcus_bains_day_view_color = NULL;
+
+       g_free (day_view->priv->marcus_bains_time_bar_color);
+       day_view->priv->marcus_bains_time_bar_color = NULL;
+
        /* Chain up to parent's dispose() method. */
        G_OBJECT_CLASS (e_day_view_parent_class)->dispose (object);
 }
diff --git a/calendar/gui/e-meeting-list-view.c b/calendar/gui/e-meeting-list-view.c
index dfbf43d..771742a 100644
--- a/calendar/gui/e-meeting-list-view.c
+++ b/calendar/gui/e-meeting-list-view.c
@@ -839,6 +839,8 @@ e_meeting_list_view_column_set_visible (EMeetingListView *view,
                        break;
                }
        }
+
+       g_list_free (cols);
 }
 
 void
diff --git a/e-util/e-cell-combo.c b/e-util/e-cell-combo.c
index 3438429..d499026 100644
--- a/e-util/e-cell-combo.c
+++ b/e-util/e-cell-combo.c
@@ -406,7 +406,8 @@ e_cell_combo_select_matching_item (ECellCombo *ecc)
        if (!found)
                gtk_tree_selection_unselect_all (selection);
 
-       e_cell_text_free_text (ecell_text, cell_text);
+       e_cell_text_free_text (ecell_text, ecv->e_table_model,
+               ecol->spec->model_col, cell_text);
 }
 
 static void
@@ -819,7 +820,8 @@ e_cell_combo_update_cell (ECellCombo *ecc)
                        ecol->spec->model_col, ecp->popup_row, text);
        }
 
-       e_cell_text_free_text (ecell_text, old_text);
+       e_cell_text_free_text (ecell_text, ecv->e_table_model,
+               ecol->spec->model_col, old_text);
        g_free (text);
 }
 
diff --git a/e-util/e-cell-date-edit.c b/e-util/e-cell-date-edit.c
index 6efe6f8..5b203b4 100644
--- a/e-util/e-cell-date-edit.c
+++ b/e-util/e-cell-date-edit.c
@@ -563,7 +563,8 @@ e_cell_date_edit_set_popup_values (ECellDateEdit *ecde)
                }
        }
 
-       e_cell_text_free_text (ecell_text, cell_text);
+       e_cell_text_free_text (ecell_text, ecv->e_table_model,
+               ecol->spec->model_col, cell_text);
 }
 
 static void
@@ -963,7 +964,8 @@ e_cell_date_edit_update_cell (ECellDateEdit *ecde,
                        ecol->spec->model_col, ecp->popup_row, NULL);
        }
 
-       e_cell_text_free_text (ecell_text, old_text);
+       e_cell_text_free_text (ecell_text, ecv->e_table_model,
+               ecol->spec->model_col, old_text);
 }
 
 static void
diff --git a/e-util/e-cell-date.c b/e-util/e-cell-date.c
index e6c4d33..973ae39 100644
--- a/e-util/e-cell-date.c
+++ b/e-util/e-cell-date.c
@@ -62,6 +62,8 @@ ecd_get_text (ECellText *cell,
 
 static void
 ecd_free_text (ECellText *cell,
+              ETableModel *model,
+              gint col,
                gchar *text)
 {
        g_free (text);
diff --git a/e-util/e-cell-number.c b/e-util/e-cell-number.c
index c83063a..c59c4b9 100644
--- a/e-util/e-cell-number.c
+++ b/e-util/e-cell-number.c
@@ -49,6 +49,8 @@ ecn_get_text (ECellText *cell,
 
 static void
 ecn_free_text (ECellText *cell,
+              ETableModel *model,
+              gint col,
                gchar *text)
 {
        g_free (text);
diff --git a/e-util/e-cell-percent.c b/e-util/e-cell-percent.c
index 668899a..981f252 100644
--- a/e-util/e-cell-percent.c
+++ b/e-util/e-cell-percent.c
@@ -62,6 +62,8 @@ ecp_get_text (ECellText *cell,
 
 static void
 ecp_free_text (ECellText *cell,
+              ETableModel *model,
+              gint col,
                gchar *text)
 {
        /* Do Nothing. */
diff --git a/e-util/e-cell-size.c b/e-util/e-cell-size.c
index 19bd491..662443e 100644
--- a/e-util/e-cell-size.c
+++ b/e-util/e-cell-size.c
@@ -54,6 +54,8 @@ ecd_get_text (ECellText *cell,
 
 static void
 ecd_free_text (ECellText *cell,
+              ETableModel *model,
+              gint col,
                gchar *text)
 {
        g_free (text);
diff --git a/e-util/e-cell-text.c b/e-util/e-cell-text.c
index 5a05da5..757954b 100644
--- a/e-util/e-cell-text.c
+++ b/e-util/e-cell-text.c
@@ -217,8 +217,11 @@ ect_real_get_text (ECellText *cell,
 
 static void
 ect_real_free_text (ECellText *cell,
+                   ETableModel *model,
+                   gint col,
                     gchar *text)
 {
+       e_table_model_free_value (model, col, text);
 }
 
 /* This is the default method for setting the ETableModel value based on
@@ -599,7 +602,7 @@ generate_layout (ECellTextView *text_view,
        if (row >= 0) {
                gchar *temp = e_cell_text_get_text (ect, ecell_view->e_table_model, model_col, row);
                layout = build_layout (text_view, row, temp ? temp : "?", width);
-               e_cell_text_free_text (ect, temp);
+               e_cell_text_free_text (ect, ecell_view->e_table_model, model_col, temp);
        } else
                layout = build_layout (text_view, row, "Mumbo Jumbo", width);
 
@@ -1143,7 +1146,7 @@ ect_enter_edit (ECellView *ecell_view,
 
        temp = e_cell_text_get_text (ect, ecell_view->e_table_model, model_col, row);
        edit->old_text = g_strdup (temp);
-       e_cell_text_free_text (ect, temp);
+       e_cell_text_free_text (ect, ecell_view->e_table_model, model_col, temp);
        edit->text = g_strdup (edit->old_text);
 
        if (edit->im_context) {
@@ -1386,7 +1389,7 @@ ect_print (ECellView *ecell_view,
 
        pango_font_description_free (font_des);
        g_object_unref (layout);
-       e_cell_text_free_text (ect, string);
+       e_cell_text_free_text (ect, ecell_view->e_table_model, model_col, string);
 }
 
 static gdouble
@@ -1942,6 +1945,8 @@ e_cell_text_get_text (ECellText *cell,
 
 void
 e_cell_text_free_text (ECellText *cell,
+                      ETableModel *model,
+                      gint col,
                        gchar *text)
 {
        ECellTextClass *class;
@@ -1952,7 +1957,7 @@ e_cell_text_free_text (ECellText *cell,
        if (class->free_text == NULL)
                return;
 
-       class->free_text (cell, text);
+       class->free_text (cell, model, col, text);
 }
 
 void
@@ -2800,7 +2805,7 @@ e_cell_text_get_text_by_view (ECellView *cell_view,
                        E_CELL_TEXT (cell_view->ecell),
                        cell_view->e_table_model, col, row);
                ret = g_strdup (model_text);
-               e_cell_text_free_text (E_CELL_TEXT (cell_view->ecell), model_text);
+               e_cell_text_free_text (E_CELL_TEXT (cell_view->ecell), cell_view->e_table_model, col, 
model_text);
        }
 
        return ret;
diff --git a/e-util/e-cell-text.h b/e-util/e-cell-text.h
index f02101e..0d8a04c 100644
--- a/e-util/e-cell-text.h
+++ b/e-util/e-cell-text.h
@@ -106,6 +106,8 @@ struct _ECellTextClass {
                                                 gint col,
                                                 gint row);
        void            (*free_text)            (ECellText *cell,
+                                                ETableModel *model,
+                                                gint col,
                                                 gchar *text);
        void            (*set_value)            (ECellText *cell,
                                                 ETableModel *model,
@@ -145,6 +147,8 @@ gchar *             e_cell_text_get_text            (ECellText *cell,
 
 /* Frees the value returned by e_cell_text_get_text(). */
 void           e_cell_text_free_text           (ECellText *cell,
+                                                ETableModel *model,
+                                                gint col,
                                                 gchar *text);
 
 /* Sets the ETableModel value, based on the given string. */
diff --git a/e-util/e-web-view.c b/e-util/e-web-view.c
index 5750ad9..ac238bc 100644
--- a/e-util/e-web-view.c
+++ b/e-util/e-web-view.c
@@ -1689,6 +1689,7 @@ e_web_view_init (EWebView *web_view)
                        G_CALLBACK (e_web_view_update_fonts), web_view);
                web_view->priv->antialiasing_changed_handler_id = handler_id;
                g_object_unref (settings);
+               g_settings_schema_unref (settings_schema);
        }
 
        e_web_view_update_fonts (web_view);
diff --git a/e-util/gal-view-instance.c b/e-util/gal-view-instance.c
index d74dc8d..26e01c3 100644
--- a/e-util/gal-view-instance.c
+++ b/e-util/gal-view-instance.c
@@ -273,7 +273,9 @@ load_current_view (GalViewInstance *instance)
        }
 
        if (doc == NULL) {
-               instance->current_id = g_strdup (gal_view_instance_get_default_view (instance));
+               gchar *view_id = g_strdup (gal_view_instance_get_default_view (instance));
+               g_free (instance->current_id);
+               instance->current_id = view_id;
 
                if (instance->current_id) {
                        gint index = gal_view_collection_get_view_index_by_id (
@@ -291,6 +293,7 @@ load_current_view (GalViewInstance *instance)
        }
 
        root = xmlDocGetRootElement (doc);
+       g_free (instance->current_id);
        instance->current_id = e_xml_get_string_prop_by_name_with_default (root, (const guchar 
*)"current_view", NULL);
 
        if (instance->current_id != NULL) {
diff --git a/mail/message-list.c b/mail/message-list.c
index 3b669b6..b8beeff 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -1435,7 +1435,7 @@ sanitize_recipients (const gchar *string)
        gchar **name;
 
        if (!string || !*string)
-               return (gchar *) "";
+               return g_string_free (recipients, FALSE);
 
        gstring = g_string_new ("");
 
@@ -1799,7 +1799,7 @@ ml_tree_value_at_ex (ETreeModel *etm,
                        return (gpointer)(res);
                }
                else
-                       return (gpointer)("");
+                       return (gpointer) g_strdup ("");
        }
        case COL_LABELS:{
                struct LabelsData ld;
@@ -2959,6 +2959,7 @@ message_list_duplicate_value (ETreeModel *tree_model,
                case COL_SENT:
                case COL_RECEIVED:
                case COL_SIZE:
+               case COL_FOLLOWUP_FLAG:
                case COL_FOLLOWUP_FLAG_STATUS:
                case COL_FOLLOWUP_DUE_BY:
                        return (gpointer) value;
@@ -2970,7 +2971,6 @@ message_list_duplicate_value (ETreeModel *tree_model,
                case COL_RECIPIENTS:
                case COL_MIXED_SENDER:
                case COL_MIXED_RECIPIENTS:
-               case COL_FOLLOWUP_FLAG:
                case COL_LOCATION:
                case COL_LABELS:
                        return g_strdup (value);
@@ -2995,19 +2995,19 @@ message_list_free_value (ETreeModel *tree_model,
                case COL_SENT:
                case COL_RECEIVED:
                case COL_SIZE:
+               case COL_FOLLOWUP_FLAG:
                case COL_FOLLOWUP_FLAG_STATUS:
                case COL_FOLLOWUP_DUE_BY:
+               case COL_FROM:
                case COL_FROM_NORM:
-               case COL_SUBJECT_NORM:
+               case COL_TO:
                case COL_TO_NORM:
+               case COL_SUBJECT:
+               case COL_SUBJECT_NORM:
                case COL_SUBJECT_TRIMMED:
                case COL_COLOUR:
                        break;
 
-               case COL_FROM:
-               case COL_SUBJECT:
-               case COL_TO:
-               case COL_FOLLOWUP_FLAG:
                case COL_LOCATION:
                case COL_SENDER:
                case COL_RECIPIENTS:
@@ -3036,14 +3036,14 @@ message_list_initialize_value (ETreeModel *tree_model,
                case COL_SENT:
                case COL_RECEIVED:
                case COL_SIZE:
-               case COL_FOLLOWUP_FLAG_STATUS:
-               case COL_FOLLOWUP_DUE_BY:
-                       return NULL;
-
                case COL_FROM:
                case COL_SUBJECT:
                case COL_TO:
                case COL_FOLLOWUP_FLAG:
+               case COL_FOLLOWUP_FLAG_STATUS:
+               case COL_FOLLOWUP_DUE_BY:
+                       return NULL;
+
                case COL_LOCATION:
                case COL_SENDER:
                case COL_RECIPIENTS:


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