diff options
author | Milan Crha <mcrha@redhat.com> | 2011-02-15 02:15:36 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@gnome-db.org> | 2011-06-30 00:41:35 +0800 |
commit | a4e2599f950cd2379a18a4c39cd27f87f090d492 (patch) | |
tree | fb1e71901c4824a0666f40d02c58a3ec72c9033c | |
parent | ecbb0bce4a854e7b617566f43a0b97f85bc63217 (diff) | |
download | gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.tar gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.tar.gz gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.tar.bz2 gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.tar.lz gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.tar.xz gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.tar.zst gsoc2013-evolution-a4e2599f950cd2379a18a4c39cd27f87f090d492.zip |
Fix few memory leaks
-rw-r--r-- | calendar/gui/e-cal-list-view.c | 3 | ||||
-rw-r--r-- | calendar/gui/e-memo-table.c | 4 | ||||
-rw-r--r-- | calendar/gui/e-task-table.c | 10 | ||||
-rw-r--r-- | e-util/e-activity.c | 9 | ||||
-rw-r--r-- | mail/e-mail-reader.c | 5 | ||||
-rw-r--r-- | mail/em-folder-tree.c | 10 | ||||
-rw-r--r-- | mail/message-list.c | 21 | ||||
-rw-r--r-- | plugins/calendar-weather/calendar-weather.c | 8 | ||||
-rw-r--r-- | plugins/templates/templates.c | 2 | ||||
-rw-r--r-- | shell/e-shell-view.c | 11 | ||||
-rw-r--r-- | widgets/table/e-cell-hbox.c | 6 | ||||
-rw-r--r-- | widgets/table/e-table-extras.c | 14 |
12 files changed, 76 insertions, 27 deletions
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c index 010de9590b..27a11787ae 100644 --- a/calendar/gui/e-cal-list-view.c +++ b/calendar/gui/e-cal-list-view.c @@ -183,6 +183,7 @@ setup_e_table (ECalListView *cal_list_view) NULL); e_table_extras_add_cell (extras, "calstring", cell); + g_object_unref (cell); /* Date fields */ @@ -214,6 +215,7 @@ setup_e_table (ECalListView *cal_list_view) G_BINDING_SYNC_CREATE); e_table_extras_add_cell (extras, "dateedit", popup_cell); + g_object_unref (popup_cell); cal_list_view->dates_cell = E_CELL_DATE_EDIT (popup_cell); gtk_widget_hide (E_CELL_DATE_EDIT (popup_cell)->none_button); @@ -243,6 +245,7 @@ setup_e_table (ECalListView *cal_list_view) g_list_free (strings); e_table_extras_add_cell (extras, "classification", popup_cell); + g_object_unref (popup_cell); /* Sorting */ diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c index 24c68905b4..9260c65411 100644 --- a/calendar/gui/e-memo-table.c +++ b/calendar/gui/e-memo-table.c @@ -347,6 +347,7 @@ memo_table_constructed (GObject *object) cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); g_object_set (cell, "bg_color_column", E_CAL_MODEL_FIELD_COLOR, NULL); e_table_extras_add_cell (extras, "calstring", cell); + g_object_unref (cell); /* * Date fields. @@ -377,6 +378,7 @@ memo_table_constructed (GObject *object) G_BINDING_SYNC_CREATE); e_table_extras_add_cell (extras, "dateedit", popup_cell); + g_object_unref (popup_cell); memo_table->dates_cell = E_CELL_DATE_EDIT (popup_cell); e_cell_date_edit_set_get_time_callback ( @@ -391,6 +393,8 @@ memo_table_constructed (GObject *object) cell = e_cell_toggle_new (icon_names, G_N_ELEMENTS (icon_names)); e_table_extras_add_cell (extras, "icon", cell); + g_object_unref (cell); + e_table_extras_add_icon_name (extras, "icon", "stock_notes"); /* set proper format component for a default 'date' cell renderer */ diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c index 60c5d50e0c..1af19e0ce6 100644 --- a/calendar/gui/e-task-table.c +++ b/calendar/gui/e-task-table.c @@ -432,6 +432,7 @@ task_table_constructed (GObject *object) NULL); e_table_extras_add_cell (extras, "calstring", cell); + g_object_unref (cell); /* * Date fields. @@ -466,6 +467,8 @@ task_table_constructed (GObject *object) G_BINDING_SYNC_CREATE); e_table_extras_add_cell (extras, "dateedit", popup_cell); + g_object_unref (popup_cell); + task_table->dates_cell = E_CELL_DATE_EDIT (popup_cell); e_cell_date_edit_set_get_time_callback ( @@ -498,6 +501,7 @@ task_table_constructed (GObject *object) g_list_free (strings); e_table_extras_add_cell (extras, "classification", popup_cell); + g_object_unref (popup_cell); /* Priority field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); @@ -522,6 +526,7 @@ task_table_constructed (GObject *object) g_list_free (strings); e_table_extras_add_cell (extras, "priority", popup_cell); + g_object_unref (popup_cell); /* Percent field. */ cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT); @@ -550,6 +555,7 @@ task_table_constructed (GObject *object) g_list_free (strings); e_table_extras_add_cell (extras, "percent", popup_cell); + g_object_unref (popup_cell); /* Transparency field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); @@ -572,6 +578,7 @@ task_table_constructed (GObject *object) g_list_free (strings); e_table_extras_add_cell (extras, "transparency", popup_cell); + g_object_unref (popup_cell); /* Status field. */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); @@ -596,6 +603,7 @@ task_table_constructed (GObject *object) g_list_free (strings); e_table_extras_add_cell (extras, "calstatus", popup_cell); + g_object_unref (popup_cell); e_table_extras_add_compare (extras, "date-compare", e_cell_date_edit_compare_cb); @@ -610,6 +618,8 @@ task_table_constructed (GObject *object) cell = e_cell_toggle_new (icon_names, G_N_ELEMENTS (icon_names)); e_table_extras_add_cell (extras, "icon", cell); + g_object_unref (cell); + e_table_extras_add_icon_name (extras, "icon", "stock_task"); e_table_extras_add_icon_name (extras, "complete", "stock_check-filled"); diff --git a/e-util/e-activity.c b/e-util/e-activity.c index 74d0eeda26..98ee4d1c0b 100644 --- a/e-util/e-activity.c +++ b/e-util/e-activity.c @@ -212,15 +212,16 @@ activity_describe (EActivity *activity) const gchar *text; gdouble percent; - string = g_string_sized_new (256); - cancellable = e_activity_get_cancellable (activity); - percent = e_activity_get_percent (activity); - state = e_activity_get_state (activity); text = e_activity_get_text (activity); if (text == NULL) return NULL; + string = g_string_sized_new (256); + cancellable = e_activity_get_cancellable (activity); + percent = e_activity_get_percent (activity); + state = e_activity_get_state (activity); + if (state == E_ACTIVITY_CANCELLED) { /* Translators: This is a cancelled activity. */ g_string_printf (string, _("%s (cancelled)"), text); diff --git a/mail/e-mail-reader.c b/mail/e-mail-reader.c index d7942d0985..a56b514227 100644 --- a/mail/e-mail-reader.c +++ b/mail/e-mail-reader.c @@ -2582,7 +2582,7 @@ mail_reader_message_loaded_cb (CamelFolder *folder, { EMailReader *reader; EMailReaderPrivate *priv; - CamelMimeMessage *message; + CamelMimeMessage *message = NULL; EMFormatHTML *formatter; GtkWidget *message_list; EMailBackend *backend; @@ -2703,6 +2703,9 @@ exit: priv->restoring_message_selection = FALSE; mail_reader_closure_free (closure); + + if (message) + g_object_unref (message); } static gboolean diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index 3472d690ce..51a116f643 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2027,7 +2027,7 @@ tree_drag_data_received (GtkWidget *widget, GtkTreeViewDropPosition pos; GtkTreeModel *model; GtkTreeView *tree_view; - GtkTreePath *dest_path; + GtkTreePath *dest_path = NULL; EMailSession *session; struct _DragDataReceivedAsync *m; gboolean is_store; @@ -2046,16 +2046,19 @@ tree_drag_data_received (GtkWidget *widget, /* this means we are receiving no data */ if (gtk_selection_data_get_data (selection) == NULL) { gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_tree_path_free (dest_path); return; } if (gtk_selection_data_get_length (selection) == -1) { gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_tree_path_free (dest_path); return; } if (!gtk_tree_model_get_iter (model, &iter, dest_path)) { gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_tree_path_free (dest_path); return; } @@ -2068,6 +2071,7 @@ tree_drag_data_received (GtkWidget *widget, /* make sure user isn't try to drop on a placeholder row */ if (full_name == NULL && !is_store) { gtk_drag_finish (context, FALSE, FALSE, GDK_CURRENT_TIME); + gtk_tree_path_free (dest_path); return; } @@ -2083,6 +2087,7 @@ tree_drag_data_received (GtkWidget *widget, m->selection = gtk_selection_data_copy (selection); tree_drag_data_action (m); + gtk_tree_path_free (dest_path); } static gboolean @@ -2475,7 +2480,7 @@ tree_drag_motion (GtkWidget *widget, GdkDragAction actions; GdkDragAction suggested_action; GdkDragAction chosen_action = 0; - GtkTreePath *path; + GtkTreePath *path = NULL; GtkTreeIter iter; GdkAtom target; gint i; @@ -2552,6 +2557,7 @@ tree_drag_motion (GtkWidget *widget, } gdk_drag_status (context, chosen_action, time); + gtk_tree_path_free (path); return chosen_action != 0; } diff --git a/mail/message-list.c b/mail/message-list.c index 2820d79bf2..3bc5915f14 100644 --- a/mail/message-list.c +++ b/mail/message-list.c @@ -1922,6 +1922,9 @@ static ECell * create_composite_cell (gint col) e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_from, show_email ? col : alt_col, 68); e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_attach, COL_ATTACHMENT, 5); e_cell_hbox_append (E_CELL_HBOX (cell_hbox), cell_date, COL_SENT, 27); + g_object_unref (cell_from); + g_object_unref (cell_attach); + g_object_unref (cell_date); cell_sub = e_cell_text_new (fixed_name? fixed_name:NULL, GTK_JUSTIFY_LEFT); g_object_set (G_OBJECT (cell_sub), @@ -1931,6 +1934,9 @@ static ECell * create_composite_cell (gint col) cell_tree = e_cell_tree_new (TRUE, cell_sub); e_cell_vbox_append (E_CELL_VBOX (cell_vbox), cell_hbox, COL_FROM); e_cell_vbox_append (E_CELL_VBOX (cell_vbox), cell_tree, COL_SUBJECT); + g_object_unref (cell_sub); + g_object_unref (cell_hbox); + g_object_unref (cell_tree); g_object_set_data (G_OBJECT (cell_vbox), "cell_date", cell_date); g_object_set_data (G_OBJECT (cell_vbox), "cell_sub", cell_sub); @@ -1966,22 +1972,27 @@ message_list_create_extras (void) cell = e_cell_toggle_new ( status_icons, G_N_ELEMENTS (status_icons)); e_table_extras_add_cell (extras, "render_message_status", cell); + g_object_unref (cell); cell = e_cell_toggle_new ( attachment_icons, G_N_ELEMENTS (attachment_icons)); e_table_extras_add_cell (extras, "render_attachment", cell); + g_object_unref (cell); cell = e_cell_toggle_new ( flagged_icons, G_N_ELEMENTS (flagged_icons)); e_table_extras_add_cell (extras, "render_flagged", cell); + g_object_unref (cell); cell = e_cell_toggle_new ( followup_icons, G_N_ELEMENTS (followup_icons)); e_table_extras_add_cell (extras, "render_flag_status", cell); + g_object_unref (cell); cell = e_cell_toggle_new ( score_icons, G_N_ELEMENTS (score_icons)); e_table_extras_add_cell (extras, "render_score", cell); + g_object_unref (cell); /* date cell */ cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT); @@ -1991,6 +2002,7 @@ message_list_create_extras (void) "color_column", COL_COLOUR, NULL); e_table_extras_add_cell (extras, "render_date", cell); + g_object_unref (cell); /* text cell */ cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); @@ -1999,9 +2011,11 @@ message_list_create_extras (void) "color_column", COL_COLOUR, NULL); e_table_extras_add_cell (extras, "render_text", cell); + g_object_unref (cell); - e_table_extras_add_cell (extras, "render_tree", - e_cell_tree_new (TRUE, cell)); + cell = e_cell_tree_new (TRUE, cell); + e_table_extras_add_cell (extras, "render_tree", cell); + g_object_unref (cell); /* size cell */ cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT); @@ -2010,13 +2024,16 @@ message_list_create_extras (void) "color_column", COL_COLOUR, NULL); e_table_extras_add_cell (extras, "render_size", cell); + g_object_unref (cell); /* Composite cell for wide view */ cell = create_composite_cell (COL_FROM); e_table_extras_add_cell (extras, "render_composite_from", cell); + g_object_unref (cell); cell = create_composite_cell (COL_TO); e_table_extras_add_cell (extras, "render_composite_to", cell); + g_object_unref (cell); /* set proper format component for a default 'date' cell renderer */ cell = e_table_extras_get_cell (extras, "date"); diff --git a/plugins/calendar-weather/calendar-weather.c b/plugins/calendar-weather/calendar-weather.c index 45cb5c48ed..f9d1180429 100644 --- a/plugins/calendar-weather/calendar-weather.c +++ b/plugins/calendar-weather/calendar-weather.c @@ -49,7 +49,7 @@ gint e_plugin_lib_enable (EPlugin *epl, gint enable); gint e_plugin_lib_enable (EPlugin *epl, gint enable) { - GList *l; + GList *l, *saved_cats; const gchar *tmp; gint ii; @@ -71,8 +71,10 @@ e_plugin_lib_enable (EPlugin *epl, gint enable) tmp = _(categories[0].description); + saved_cats = e_categories_get_list (); + /* Add the categories icons if we don't have them. */ - for (l = e_categories_get_list (); l; l = g_list_next (l)) { + for (l = saved_cats; l; l = g_list_next (l)) { if (!strcmp ((const gchar *)l->data, tmp)) goto exit; } @@ -88,6 +90,8 @@ e_plugin_lib_enable (EPlugin *epl, gint enable) } exit: + g_list_free (saved_cats); + return 0; } diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 3e3bb49195..fd8f8021f7 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -629,8 +629,6 @@ build_template_menus_recurse (GtkUIManager *ui_manager, if (template == NULL) continue; - g_object_ref (template); - action_label = camel_mime_message_get_subject (template); if (action_label == NULL || *action_label == '\0') diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index e513eea681..87ec90d058 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -108,8 +108,6 @@ shell_view_init_search_context (EShellViewClass *class) { EShellBackend *shell_backend; ERuleContext *search_context; - EFilterRule *rule; - EFilterPart *part; const gchar *config_dir; gchar *system_filename; gchar *user_filename; @@ -145,15 +143,6 @@ shell_view_init_search_context (EShellViewClass *class) e_rule_context_add_rule, e_rule_context_next_rule); e_rule_context_load (search_context, system_filename, user_filename); - rule = e_filter_rule_new (); - part = e_rule_context_next_part (search_context, NULL); - if (part == NULL) - g_warning ( - "Could not load %s search: no parts", - G_OBJECT_CLASS_NAME (class)); - else - e_filter_rule_add_part (rule, e_filter_part_clone (part)); - g_free (system_filename); g_free (user_filename); } diff --git a/widgets/table/e-cell-hbox.c b/widgets/table/e-cell-hbox.c index 6710f60bd5..e8f6a0925d 100644 --- a/widgets/table/e-cell-hbox.c +++ b/widgets/table/e-cell-hbox.c @@ -266,6 +266,12 @@ ecv_dispose (GObject *object) ecv->subcells = NULL; ecv->subcell_count = 0; + g_free (ecv->model_cols); + ecv->model_cols = NULL; + + g_free (ecv->def_size_cols); + ecv->def_size_cols = NULL; + G_OBJECT_CLASS (e_cell_hbox_parent_class)->dispose (object); } diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c index e42700d6c4..f6dc1118da 100644 --- a/widgets/table/e-table-extras.c +++ b/widgets/table/e-table-extras.c @@ -232,7 +232,7 @@ safe_unref (gpointer object) static void ete_init (ETableExtras *extras) { - ECell *cell; + ECell *cell, *sub_cell; extras->priv = E_TABLE_EXTRAS_GET_PRIVATE (extras); @@ -276,25 +276,33 @@ ete_init (ETableExtras *extras) cell = e_cell_checkbox_new (); e_table_extras_add_cell (extras, "checkbox", cell); + g_object_unref (cell); cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT); e_table_extras_add_cell (extras, "date", cell); + g_object_unref (cell); cell = e_cell_number_new (NULL, GTK_JUSTIFY_RIGHT); e_table_extras_add_cell (extras, "number", cell); + g_object_unref (cell); cell = e_cell_pixbuf_new (); e_table_extras_add_cell (extras, "pixbuf", cell); + g_object_unref (cell); cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT); e_table_extras_add_cell (extras, "size", cell); + g_object_unref (cell); cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); e_table_extras_add_cell (extras, "string", cell); + g_object_unref (cell); - cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); - cell = e_cell_tree_new (TRUE, cell); + sub_cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT); + cell = e_cell_tree_new (TRUE, sub_cell); e_table_extras_add_cell (extras, "tree-string", cell); + g_object_unref (sub_cell); + g_object_unref (cell); } ETableExtras * |