[gnome-builder/gnome-builder-3-34] foundry: do not return mask from get_requested_phase()



commit f64dc9d304bf691eeb83c9e7319505c48dc3a0fa
Author: Christian Hergert <chergert redhat com>
Date:   Mon Dec 2 10:58:49 2019 -0800

    foundry: do not return mask from get_requested_phase()
    
    When fetching the requested phase of the pipeline, we only want
    the most significant phase, not the mask of all phases that will
    be run working our way up to that phase.
    
    This is simply the MSB after the BEFORE|AFTER bits are removed.
    
    Fixes #1081

 src/libide/foundry/ide-pipeline.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/libide/foundry/ide-pipeline.c b/src/libide/foundry/ide-pipeline.c
index fc86565f3..7727b57c3 100644
--- a/src/libide/foundry/ide-pipeline.c
+++ b/src/libide/foundry/ide-pipeline.c
@@ -3939,9 +3939,25 @@ list_model_iface_init (GListModelInterface *iface)
 IdePipelinePhase
 ide_pipeline_get_requested_phase (IdePipeline *self)
 {
+  IdePipelinePhase requested;
+  gint msb;
+
   g_return_val_if_fail (IDE_IS_PIPELINE (self), 0);
 
-  return self->requested_mask & IDE_PIPELINE_PHASE_MASK;
+  requested = self->requested_mask & IDE_PIPELINE_PHASE_MASK;
+
+  /* We want to return a value that is not a mask of all phases
+   * that will be run, but just the most signficant phase. This
+   * is represented by the most-signficant-bit after our phase
+   * mask has been applied.
+   */
+
+  msb = g_bit_nth_msf (requested, -1);
+
+  if (msb == -1)
+    return IDE_PIPELINE_PHASE_NONE;
+
+  return (IdePipelinePhase)(1 << msb);
 }
 
 void


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