[gnome-builder] foundry: steal build target to avoid destroy signal



commit 6ca5a265c3f8e9b5f799dcf620e04d577dac7ef9
Author: Christian Hergert <chergert redhat com>
Date:   Wed Feb 6 13:22:48 2019 -0800

    foundry: steal build target to avoid destroy signal
    
    Related #802

 src/libide/foundry/ide-run-manager.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/libide/foundry/ide-run-manager.c b/src/libide/foundry/ide-run-manager.c
index fdf104304..02a6629f9 100644
--- a/src/libide/foundry/ide-run-manager.c
+++ b/src/libide/foundry/ide-run-manager.c
@@ -922,6 +922,7 @@ ide_run_manager_provider_get_targets_cb (GObject      *object,
                                          gpointer      user_data)
 {
   IdeBuildTargetProvider *provider = (IdeBuildTargetProvider *)object;
+  g_autoptr(IdeBuildTarget) first = NULL;
   g_autoptr(IdeTask) task = user_data;
   g_autoptr(GPtrArray) ret = NULL;
   g_autoptr(GError) error = NULL;
@@ -979,9 +980,13 @@ ide_run_manager_provider_get_targets_cb (GObject      *object,
 
   g_ptr_array_sort (state->results, compare_targets);
 
+  /* Steal the first item so that it is not destroyed */
+  first = ide_ptr_array_steal_index (state->results,
+                                     0,
+                                     (GDestroyNotify)ide_object_unref_and_destroy);
   ide_task_return_pointer (task,
-                           g_object_ref (g_ptr_array_index (state->results, 0)),
-                           g_object_unref);
+                           g_steal_pointer (&first),
+                           (GDestroyNotify)ide_object_unref_and_destroy);
 
   IDE_EXIT;
 }


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