[glade/glade-3-20] Gtk+ plugin: fix GtkStack replace child function



commit bb43c9a2a32c1ade500cdf40856139a086b9f22b
Author: Juan Pablo Ugarte <juanpablougarte gmail com>
Date:   Wed Feb 28 20:58:03 2018 -0300

    Gtk+ plugin: fix GtkStack replace child function
    
    Fi bug 793652 "Crash when deleting a list"

 plugins/gtk+/glade-gtk-stack.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/plugins/gtk+/glade-gtk-stack.c b/plugins/gtk+/glade-gtk-stack.c
index 3cf3c3a..28bb679 100644
--- a/plugins/gtk+/glade-gtk-stack.c
+++ b/plugins/gtk+/glade-gtk-stack.c
@@ -548,13 +548,16 @@ glade_gtk_stack_replace_child (GladeWidgetAdaptor * adaptor,
                                                      new_widget);
 
   gbox = glade_widget_get_from_gobject (container);
-  glade_widget_property_get (gbox, "pages", &pages);
-  glade_widget_property_set (gbox, "pages", pages);
-  glade_widget_property_get (gbox, "page", &page);
-  glade_widget_property_set (gbox, "page", page);
 
   gchild = glade_widget_get_from_gobject (new_widget);
   if (gchild != NULL)
     glade_widget_set_pack_action_visible (gchild, "remove_page", FALSE);
 
+  /* NOTE: make sure to sync this at the end because new_widget could be
+   * a placeholder and syncing these properties could destroy it.
+   */
+  glade_widget_property_get (gbox, "pages", &pages);
+  glade_widget_property_set (gbox, "pages", pages);
+  glade_widget_property_get (gbox, "page", &page);
+  glade_widget_property_set (gbox, "page", page);
 }


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