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)
This commit is contained in:
Lubomir Rintel 2019-05-30 11:29:50 +02:00
parent d691393f5f
commit 1e7225aa1c

View File

@ -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);