From c0b8eb30decf2342b747117039a18dfaeb1b6be8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 26 Aug 2019 15:34:15 +0200 Subject: Fix a crash in gtk-builder-tool Crash pointed out by Bastien Nocera. Testcase included. --- gtk/tools/gtk-builder-tool-simplify.c | 5 + .../simplify-data-3to4/office-runner.expected | 207 +++++++++++++++ .../tools/simplify-data-3to4/office-runner.ui | 286 +++++++++++++++++++++ 3 files changed, 498 insertions(+) create mode 100644 testsuite/tools/simplify-data-3to4/office-runner.expected create mode 100644 testsuite/tools/simplify-data-3to4/office-runner.ui diff --git a/gtk/tools/gtk-builder-tool-simplify.c b/gtk/tools/gtk-builder-tool-simplify.c index a7f7ecbcbb..dc6462882e 100644 --- a/gtk/tools/gtk-builder-tool-simplify.c +++ b/gtk/tools/gtk-builder-tool-simplify.c @@ -793,6 +793,7 @@ rewrite_stack_child (Element *child, MyParserData *data) new_object->attribute_values = g_new0 (char *, 2); new_object->attribute_values[0] = g_strdup ("GtkStackPage"); new_object->children = packing->children; + new_object->parent = child; packing->children = NULL; prop = g_new0 (Element, 1); @@ -802,6 +803,7 @@ rewrite_stack_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); @@ -940,6 +942,7 @@ rewrite_notebook_page (Element *child, Element *tab, MyParserData *data) new_object->attribute_names[0] = g_strdup ("class"); new_object->attribute_values = g_new0 (char *, 2); new_object->attribute_values[0] = g_strdup ("GtkNotebookPage"); + new_object->parent = child; if (packing) { new_object->children = packing->children; @@ -953,6 +956,7 @@ rewrite_notebook_page (Element *child, Element *tab, 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); if (tab_obj) @@ -964,6 +968,7 @@ rewrite_notebook_page (Element *child, Element *tab, MyParserData *data) prop->attribute_values = g_new0 (char *, 2); prop->attribute_values[0] = g_strdup ("tab"); prop->children = g_list_append (prop->children, tab_obj); + prop->parent = new_object; new_object->children = g_list_append (new_object->children, prop); } diff --git a/testsuite/tools/simplify-data-3to4/office-runner.expected b/testsuite/tools/simplify-data-3to4/office-runner.expected new file mode 100644 index 0000000000..6b32fa1616 --- /dev/null +++ b/testsuite/tools/simplify-data-3to4/office-runner.expected @@ -0,0 +1,207 @@ + + + + 12 + Office Runner + 0 + center + + + 12 + 12 + 12 + vertical + 12 + + + 0 + 0 + + + + + 12 + 12 + + + 1 + + + + + start + 1 + 0 + • Click the "Run!" button, and then dash to your desk or meeting. + • You are allowed to close your laptop lid to run faster + + 1 + + 1 + 1 + + + + + + Rules + + + + + 1 + + + + + + + + + + + page 1 + + + + + + + 1 + + + 12 + 12 + + + 1 + + 1 + + + + + + 1 + 1 + 00:00.00 + + + + + + + + + + + page 2 + + + + + + + 2 + + + 1 + 12 + 12 + + + + + + center + vertical + + + start + 0 + Silver Trophy! + 1 + + + + + + + + False + True + + + + + start + 0 + You managed to finish the route with the 2nd best time ever, <b>48.15 seconds!</b> + 1 + 1 + + + False + True + + + + + start + 0 + Only <b>3.75 seconds</b> separate you from the gold trophy! + 1 + 1 + + + False + True + + + + 1 + + + + + + + + page 3 + + + + + + + False + True + + + + + 1 + 1 + 1 + 1 + False + + + Run! + + + + + + + + False + True + + + + + + diff --git a/testsuite/tools/simplify-data-3to4/office-runner.ui b/testsuite/tools/simplify-data-3to4/office-runner.ui new file mode 100644 index 0000000000..e4a237f78f --- /dev/null +++ b/testsuite/tools/simplify-data-3to4/office-runner.ui @@ -0,0 +1,286 @@ + + + + + False + 12 + Office Runner + False + center + + + True + False + 12 + 12 + 12 + vertical + 12 + + + True + False + False + False + + + True + False + 12 + 12 + + + True + False + True + + + 0 + 0 + 1 + 1 + + + + + True + False + start + True + 0 + • Click the "Run!" button, and then dash to your desk or meeting. + • You are allowed to close your laptop lid to run faster + + True + + + 1 + 1 + 1 + 1 + + + + + True + False + Rules + + + + + + 1 + 0 + 1 + 1 + + + + + + + + + + True + False + page 1 + + + False + + + + + True + False + 12 + 12 + + + True + False + True + + + 1 + 0 + 1 + 1 + + + + + True + False + True + True + 00:00.00 + + + + + + + 0 + 0 + 1 + 1 + + + + + 1 + + + + + True + False + page 2 + + + 1 + False + + + + + True + False + True + 12 + 12 + + + True + False + + + 0 + 0 + 1 + 1 + + + + + True + False + center + vertical + + + True + False + start + 0 + Silver Trophy! + True + + + + + + + + False + True + 0 + + + + + True + False + start + 0 + You managed to finish the route with the 2nd best time ever, <b>48.15 seconds!</b> + True + True + + + False + True + 1 + + + + + True + False + start + 0 + Only <b>3.75 seconds</b> separate you from the gold trophy! + True + True + + + False + True + 2 + + + + + 1 + 0 + 1 + 1 + + + + + 2 + + + + + True + False + page 3 + + + 2 + False + + + + + False + True + 0 + + + + + True + True + True + True + True + False + + + True + False + Run! + + + + + + + + False + True + 1 + + + + + + -- cgit v1.2.1