aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-01 13:05:03 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-01-01 13:05:03 +0200
commite44fb9257a0e747418eda7ae254ac761147b6d65 (patch)
tree418934968fcaf07c83d07e4b6a4320bc219f2ba7
parent9e8b86bb9ef84d6214a9ea2110cf6ed83f4ddcd3 (diff)
Fix lifetime issue in progress monitoring logic
-rw-r--r--build2/operation.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/build2/operation.cxx b/build2/operation.cxx
index 82b546c..698edbb 100644
--- a/build2/operation.cxx
+++ b/build2/operation.cxx
@@ -124,8 +124,8 @@ namespace build2
// Setup progress reporting if requested.
//
+ string what; // Note: must outlive monitor_guard.
scheduler::monitor_guard mg;
- string what;
if (ops.progress () ||
(stderr_term && verb >= 1 && verb <= 2 && !ops.no_progress ()))
{
@@ -273,8 +273,9 @@ namespace build2
// Setup progress reporting if requested.
//
+ string what; // Note: must outlive monitor_guard.
scheduler::monitor_guard mg;
- string what;
+
if (ops.progress () || (stderr_term && verb == 1 && !ops.no_progress ()))
{
size_t init (target_count.load (memory_order_relaxed));