diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-14 19:12:29 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2011-11-14 22:38:03 +0800 |
commit | 3af870ef59c375699799df71e320764c488b3094 (patch) | |
tree | d0c057a20503734dccd5b1a79452a0ace43f26fe | |
parent | 338a3ec1624d35a6dfe4ac859a901c6635dbaa39 (diff) | |
download | gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.tar gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.tar.gz gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.tar.bz2 gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.tar.lz gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.tar.xz gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.tar.zst gsoc2013-empathy-3af870ef59c375699799df71e320764c488b3094.zip |
free GDate leaks when inserting them into the model
The model copies the date so we should free it afterward.
https://bugzilla.gnome.org/show_bug.cgi?id=663873
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index cc3a90614..aa1acc9cc 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -1817,18 +1817,27 @@ populate_dates_from_search_hits (GList *accounts, if (gtk_tree_model_get_iter_first (model, &iter)) { + GDate *date; + + date = g_date_new_dmy (1, 1, -1), + gtk_list_store_prepend (store, &iter); gtk_list_store_set (store, &iter, - COL_WHEN_DATE, g_date_new_dmy (1, 1, -1), + COL_WHEN_DATE, date, COL_WHEN_TEXT, "separator", -1); + g_date_free (date); + + date = g_date_new_dmy (2, 1, -1), gtk_list_store_prepend (store, &iter); gtk_list_store_set (store, &iter, - COL_WHEN_DATE, g_date_new_dmy (2, 1, -1), + COL_WHEN_DATE, date, COL_WHEN_TEXT, _("Anytime"), -1); + g_date_free (date); + if (gtk_tree_model_iter_nth_child (model, &iter, NULL, 2)) gtk_tree_selection_select_iter (selection, &iter); } @@ -3432,17 +3441,27 @@ log_manager_got_dates_cb (GObject *manager, if (g_strcmp0 (separator, "separator") != 0) { + GDate *date; + + date = g_date_new_dmy (1, 1, -1); + gtk_list_store_prepend (store, &iter); gtk_list_store_set (store, &iter, - COL_WHEN_DATE, g_date_new_dmy (1, 1, -1), + COL_WHEN_DATE, date, COL_WHEN_TEXT, "separator", -1); + g_date_free (date); + + date = g_date_new_dmy (2, 1, -1); + gtk_list_store_prepend (store, &iter); gtk_list_store_set (store, &iter, - COL_WHEN_DATE, g_date_new_dmy (2, 1, -1), + COL_WHEN_DATE, date, COL_WHEN_TEXT, _("Anytime"), -1); + + g_date_free (date); } } |