[empathy] free GDate leaks when inserting them into the model
- From: Guillaume Desmottes <gdesmott src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy] free GDate leaks when inserting them into the model
- Date: Mon, 14 Nov 2011 14:39:01 +0000 (UTC)
commit 45da1ad2170f19eecb8abe6e55ae1be851ddfb18
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date: Mon Nov 14 12:12:29 2011 +0100
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
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 10ea8af..4addfda 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -1803,18 +1803,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);
}
@@ -3418,17 +3427,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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]