[gnome-builder] plugins/xml-pack: be more defensive



commit 16e9754eae825e34cad51f42a717a5a0d3cd75b1
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 24 00:11:02 2022 -0700

    plugins/xml-pack: be more defensive
    
    There is definitely an issue somewhere in here wrt to ZeroOrOne completion
    but I haven't had time to learn how the XML indenter works.

 src/plugins/xml-pack/ide-xml-completion-provider.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/plugins/xml-pack/ide-xml-completion-provider.c 
b/src/plugins/xml-pack/ide-xml-completion-provider.c
index 74982cab3..372d7366e 100644
--- a/src/plugins/xml-pack/ide-xml-completion-provider.c
+++ b/src/plugins/xml-pack/ide-xml-completion-provider.c
@@ -121,14 +121,14 @@ copy_children (GPtrArray *children)
 }
 
 static void
-state_stack_item_free (gpointer *data)
+state_stack_item_clear (gpointer data)
 {
-  StateStackItem *item;
+  StateStackItem *item = data;
 
-  g_assert (data != NULL);
+  g_assert (item != NULL);
 
-  item = (StateStackItem *)data;
-  g_ptr_array_unref (item->children);
+  g_clear_pointer (&item->children, g_ptr_array_unref);
+  item->candidate_node = NULL;
 }
 
 static GArray *
@@ -137,7 +137,7 @@ state_stack_new (void)
   GArray *stack;
 
   stack = g_array_new (FALSE, TRUE, sizeof (StateStackItem));
-  g_array_set_clear_func (stack, (GDestroyNotify)state_stack_item_free);
+  g_array_set_clear_func (stack, state_stack_item_clear);
 
   return stack;
 }


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