[libadwaita/wip/exalm/new-glib: 4/8] leaflet: Prevent an infinite loop in dispose()




commit 2d8dcb0fa4b0151d2d5e0fb5ecefcd9409290649
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Wed Nov 3 00:27:26 2021 +0500

    leaflet: Prevent an infinite loop in dispose()
    
    We are currently endlessly trying to remove the shadow children with
    leaflet_remove(). That won't work. The only reason it doesn't freeze
    anything is because we have a refcycle between leaflet and shadow helper
    anyway.

 src/adw-leaflet.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/adw-leaflet.c b/src/adw-leaflet.c
index 74bf6a7b..c5d6245e 100644
--- a/src/adw-leaflet.c
+++ b/src/adw-leaflet.c
@@ -2144,6 +2144,8 @@ adw_leaflet_dispose (GObject *object)
   AdwLeaflet *self = ADW_LEAFLET (object);
   GtkWidget *child;
 
+  g_clear_object (&self->shadow_helper);
+
   if (self->pages)
     g_list_model_items_changed (G_LIST_MODEL (self->pages), 0,
                                 g_list_length (self->children), 0);
@@ -2151,8 +2153,6 @@ adw_leaflet_dispose (GObject *object)
   while ((child = gtk_widget_get_first_child (GTK_WIDGET (self))))
     leaflet_remove (self, child, TRUE);
 
-  g_clear_object (&self->shadow_helper);
-
   G_OBJECT_CLASS (adw_leaflet_parent_class)->dispose (object);
 }
 


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