[gnome-builder/gnome-builder-3-24] buildmanager: synthesize build failure when invaliding pipeline



commit 54e9c13e1a9a06ac1e9db181cc14e8bcd9d246e6
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 8 15:06:10 2017 -0700

    buildmanager: synthesize build failure when invaliding pipeline
    
    If we are currently building something, we need to synthesize a build
    failure for the current build and cancel any in-flight timers.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781961

 libide/buildsystem/ide-build-manager.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/libide/buildsystem/ide-build-manager.c b/libide/buildsystem/ide-build-manager.c
index 2014e2e..f406a13 100644
--- a/libide/buildsystem/ide-build-manager.c
+++ b/libide/buildsystem/ide-build-manager.c
@@ -48,6 +48,7 @@ struct _IdeBuildManager
   guint             timer_source;
 
   guint             can_build : 1;
+  guint             building : 1;
 };
 
 static void initable_iface_init             (GInitableIface        *iface);
@@ -235,6 +236,8 @@ ide_build_manager_pipeline_started (IdeBuildManager  *self,
   g_assert (IDE_IS_BUILD_MANAGER (self));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
 
+  self->building = TRUE;
+
   g_signal_emit (self, signals [BUILD_STARTED], 0, pipeline);
 
   IDE_EXIT;
@@ -250,6 +253,8 @@ ide_build_manager_pipeline_finished (IdeBuildManager  *self,
   g_assert (IDE_IS_BUILD_MANAGER (self));
   g_assert (IDE_IS_BUILD_PIPELINE (pipeline));
 
+  self->building = FALSE;
+
   if (failed)
     g_signal_emit (self, signals [BUILD_FAILED], 0, pipeline);
   else
@@ -337,6 +342,19 @@ ide_build_manager_invalidate_pipeline (IdeBuildManager *self)
   IDE_TRACE_MSG ("Reloading pipeline due to configuration change");
 
   /*
+   * If we are currently building, we need to synthesize the failure
+   * of that build and re-setup the pipeline.
+   */
+  if (self->building)
+    {
+      g_assert (self->pipeline != NULL);
+
+      self->building = FALSE;
+      ide_clear_source (&self->timer_source);
+      g_signal_emit (self, signals [BUILD_FAILED], 0, self->pipeline);
+    }
+
+  /*
    * Cancel and clear our previous pipeline and associated components
    * as they are not invalide.
    */


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