[gnome-builder] buildmanager: use consistent convention for cancellables



commit 8762ed6fee3552a807aa5dba981d62faa10d76c4
Author: Christian Hergert <chergert redhat com>
Date:   Thu Feb 16 14:32:42 2017 -0800

    buildmanager: use consistent convention for cancellables
    
    This changes how we detect missing cancellables in rebuild and clean so
    they match how we do it in execute.

 libide/buildsystem/ide-build-manager.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-manager.c b/libide/buildsystem/ide-build-manager.c
index 3b51f8e..737aaad 100644
--- a/libide/buildsystem/ide-build-manager.c
+++ b/libide/buildsystem/ide-build-manager.c
@@ -1118,6 +1118,7 @@ ide_build_manager_clean_async (IdeBuildManager     *self,
                                GAsyncReadyCallback  callback,
                                gpointer             user_data)
 {
+  g_autoptr(GCancellable) local_cancellable = NULL;
   g_autoptr(GTask) task = NULL;
 
   IDE_ENTRY;
@@ -1125,6 +1126,9 @@ ide_build_manager_clean_async (IdeBuildManager     *self,
   g_return_if_fail (IDE_IS_BUILD_MANAGER (self));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
+  if (cancellable == NULL)
+    cancellable = local_cancellable = g_cancellable_new ();
+
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, ide_build_manager_clean_async);
 
@@ -1139,9 +1143,6 @@ ide_build_manager_clean_async (IdeBuildManager     *self,
 
   g_set_object (&self->cancellable, cancellable);
 
-  if (self->cancellable == NULL)
-    self->cancellable = g_cancellable_new ();
-
   self->diagnostic_count = 0;
 
   ide_build_pipeline_clean_async (self->pipeline,
@@ -1272,6 +1273,7 @@ ide_build_manager_rebuild_async (IdeBuildManager     *self,
                                  GAsyncReadyCallback  callback,
                                  gpointer             user_data)
 {
+  g_autoptr(GCancellable) local_cancellable = NULL;
   g_autoptr(GTask) task = NULL;
 
   IDE_ENTRY;
@@ -1279,6 +1281,9 @@ ide_build_manager_rebuild_async (IdeBuildManager     *self,
   g_return_if_fail (IDE_IS_BUILD_MANAGER (self));
   g_return_if_fail (!cancellable || G_IS_CANCELLABLE (cancellable));
 
+  if (cancellable == NULL)
+    cancellable = local_cancellable = g_cancellable_new ();
+
   task = g_task_new (self, cancellable, callback, user_data);
   g_task_set_source_tag (task, ide_build_manager_rebuild_async);
 
@@ -1293,9 +1298,6 @@ ide_build_manager_rebuild_async (IdeBuildManager     *self,
 
   g_set_object (&self->cancellable, cancellable);
 
-  if (self->cancellable == NULL)
-    self->cancellable = g_cancellable_new ();
-
   ide_build_pipeline_rebuild_async (self->pipeline,
                                     phase,
                                     self->cancellable,


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