[epiphany/wip/exalm/leak] Don't leak gtk_container_get_children() lists




commit 08a9b958e4e0ca78bf0942aa7e205e68e9d3203d
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Feb 15 16:20:41 2022 +0500

    Don't leak gtk_container_get_children() lists
    
    Part-of: <https://gitlab.gnome.org/GNOME/epiphany/-/merge_requests/1071>

 src/ephy-history-dialog.c                    | 4 ++--
 src/preferences/ephy-search-engine-listbox.c | 2 +-
 src/preferences/prefs-general-page.c         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/ephy-history-dialog.c b/src/ephy-history-dialog.c
index 89a279fb7..201908c70 100644
--- a/src/ephy-history-dialog.c
+++ b/src/ephy-history-dialog.c
@@ -623,8 +623,8 @@ on_key_press_event (EphyHistoryDialog *self,
     return GDK_EVENT_STOP;
 
   if (key->keyval == GDK_KEY_Down || key->keyval == GDK_KEY_Page_Down) {
-    GList *childrens = gtk_container_get_children (GTK_CONTAINER (self->listbox));
-    GtkWidget *last = g_list_last (childrens)->data;
+    g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (self->listbox));
+    GtkWidget *last = g_list_last (children)->data;
     GtkWidget *focus = gtk_container_get_focus_child (GTK_CONTAINER (self->listbox));
 
     if (focus == last) {
diff --git a/src/preferences/ephy-search-engine-listbox.c b/src/preferences/ephy-search-engine-listbox.c
index 0f0788b5f..111546185 100644
--- a/src/preferences/ephy-search-engine-listbox.c
+++ b/src/preferences/ephy-search-engine-listbox.c
@@ -255,7 +255,7 @@ on_row_expand_state_changed_cb (EphySearchEngineRow     *expanded_row,
                                 GParamSpec              *pspec,
                                 EphySearchEngineListBox *parent_list_box)
 {
-  GList *children = gtk_container_get_children (GTK_CONTAINER (parent_list_box));
+  g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (parent_list_box));
 
   /* We only unexpand other rows if this is a notify signal for an expanded row. */
   if (!hdy_expander_row_get_expanded (HDY_EXPANDER_ROW (expanded_row)))
diff --git a/src/preferences/prefs-general-page.c b/src/preferences/prefs-general-page.c
index dc4517f88..286651358 100644
--- a/src/preferences/prefs-general-page.c
+++ b/src/preferences/prefs-general-page.c
@@ -115,7 +115,7 @@ prefs_general_page_finalize (GObject *object)
 static int
 get_list_box_length (GtkListBox *list_box)
 {
-  GList *children = gtk_container_get_children (GTK_CONTAINER (list_box));
+  g_autoptr (GList) children = gtk_container_get_children (GTK_CONTAINER (list_box));
 
   return g_list_length (children);
 }


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