Fix few memory leaks

This commit is contained in:
Milan Crha
2011-02-14 19:15:36 +01:00
committed by Rodrigo Moya
parent ecbb0bce4a
commit a4e2599f95
12 changed files with 76 additions and 27 deletions

View File

@ -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 */

View File

@ -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 */

View File

@ -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");

View File

@ -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);

View File

@ -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

View File

@ -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;
}

View File

@ -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");

View File

@ -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;
}

View File

@ -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')

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 *