[gnome-builder] buildui: destroy extension set after use



commit 8e253d1010ff2c35c35790814be8b3ec22bca7ed
Author: Christian Hergert <chergert redhat com>
Date:   Mon Feb 18 21:52:00 2019 -0800

    buildui: destroy extension set after use
    
    After we use the build targets, we can destroy the providers.

 src/plugins/buildui/gbp-buildui-tree-addin.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/plugins/buildui/gbp-buildui-tree-addin.c b/src/plugins/buildui/gbp-buildui-tree-addin.c
index 66500974e..f05c5e20f 100644
--- a/src/plugins/buildui/gbp-buildui-tree-addin.c
+++ b/src/plugins/buildui/gbp-buildui-tree-addin.c
@@ -41,14 +41,16 @@ struct _GbpBuilduiTreeAddin
 
 typedef struct
 {
-  IdeTreeNode *node;
-  guint        n_active;
+  IdeExtensionSetAdapter *set;
+  IdeTreeNode            *node;
+  guint                   n_active;
 } BuildTargets;
 
 static void
 build_targets_free (BuildTargets *state)
 {
   g_clear_object (&state->node);
+  ide_clear_and_destroy_object (&state->set);
   g_slice_free (BuildTargets, state);
 }
 
@@ -153,19 +155,18 @@ gbp_buildui_tree_addin_build_children_async (IdeTreeAddin        *addin,
     }
   else if (ide_tree_node_is_tag (node, "BUILD_TARGETS"))
     {
-      g_autoptr(IdeExtensionSetAdapter) set = NULL;
       BuildTargets *state;
 
       state = g_slice_new0 (BuildTargets);
       state->node = g_object_ref (node);
       state->n_active = 0;
+      state->set = ide_extension_set_adapter_new (IDE_OBJECT (self->model),
+                                                  peas_engine_get_default (),
+                                                  IDE_TYPE_BUILD_TARGET_PROVIDER,
+                                                  NULL, NULL);
       ide_task_set_task_data (task, state, build_targets_free);
 
-      set = ide_extension_set_adapter_new (IDE_OBJECT (self->model),
-                                           peas_engine_get_default (),
-                                           IDE_TYPE_BUILD_TARGET_PROVIDER,
-                                           NULL, NULL);
-      ide_extension_set_adapter_foreach (set, build_targets_cb, task);
+      ide_extension_set_adapter_foreach (state->set, build_targets_cb, task);
 
       if (state->n_active > 0)
         return;


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