[gtk: 1/2] builder-tool: Set the parent of newly created GtkAssistantPage



commit 1e7225aa1c20525da023f378405de0a8e4c9fc2d
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu May 30 11:29:50 2019 +0200

    builder-tool: Set the parent of newly created GtkAssistantPage
    
    ...and its property. Otherwise simplify_element() blows up when looking
    up the hierarchy to determine a property type.
    
      $ gtk4-builder-tool simplify --3to4 /dev/stdin <<EOF
      > <?xml version="1.0" encoding="UTF-8"?>
      > <!-- Generated with glade 3.20.2 -->
      > <interface domain="nm-applet">
      >   <object class="GtkAssistant">
      >     <child>
      >       <object class="GtkBox" id="confirm_page">
      >       </object>
      >       <packing>
      >         <property name="page_type">confirm</property>
      >         <property name="complete">True</property>
      >       </packing>
      >     </child>
      >   </object>
      > </interface>
      > EOF
      /dev/stdin: Packing property GtkAssistant::page_type not found
      /dev/stdin: Packing property GtkAssistant::complete not found
      Segmentation fault (core dumped)

 gtk/tools/gtk-builder-tool-simplify.c | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/gtk/tools/gtk-builder-tool-simplify.c b/gtk/tools/gtk-builder-tool-simplify.c
index 776496ca4a..5919d9d7f7 100644
--- a/gtk/tools/gtk-builder-tool-simplify.c
+++ b/gtk/tools/gtk-builder-tool-simplify.c
@@ -852,6 +852,7 @@ rewrite_assistant_child (Element *child, MyParserData *data)
   new_object->attribute_values = g_new0 (char *, 2);
   new_object->attribute_values[0] = g_strdup ("GtkAssistantPage");
   new_object->children = packing->children;
+  new_object->parent = child;
   packing->children = NULL;
 
   prop = g_new0 (Element, 1);
@@ -861,6 +862,7 @@ rewrite_assistant_child (Element *child, MyParserData *data)
   prop->attribute_values = g_new0 (char *, 2);
   prop->attribute_values[0] = g_strdup ("child");
   prop->children = g_list_append (prop->children, object);
+  prop->parent = new_object;
   new_object->children = g_list_append (new_object->children, prop);
       
   g_list_free (child->children);


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