[gtk/wip/cdavis/listbox-dispose-fix] gtklistbox: Use get_row_at_index () for iterating in dispose ()




commit 220115c78a1c876f6cb039917baf7265bb4ebe54
Author: Christopher Davis <christopherdavis gnome org>
Date:   Mon Jan 31 16:30:58 2022 -0800

    gtklistbox: Use get_row_at_index () for iterating in dispose ()
    
    Previously we used `get_first_child ()`, which could
    cause issues with e.g. headers.

 gtk/gtklistbox.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index 3a75bc0f3e..b3c42bea3f 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -433,9 +433,11 @@ gtk_list_box_dispose (GObject *object)
 {
   GtkWidget *child;
 
-  while ((child = gtk_widget_get_first_child (GTK_WIDGET (object))))
+  while ((child = GTK_WIDGET (gtk_list_box_get_row_at_index (GTK_LIST_BOX (object), 0))))
     gtk_list_box_remove (GTK_LIST_BOX (object), child);
 
+  gtk_list_box_set_placeholder (GTK_LIST_BOX (object), NULL);
+
   G_OBJECT_CLASS (gtk_list_box_parent_class)->dispose (object);
 }
 


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