From c0a025542988b63275fe1f9281020f4d4bec58a6 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Sat, 30 May 2020 20:03:45 +0300 Subject: Fix process_path() constructor --- libbutl/process.ixx | 8 ++++++-- libbutl/process.mxx | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libbutl/process.ixx b/libbutl/process.ixx index 07c8bac..eba6be5 100644 --- a/libbutl/process.ixx +++ b/libbutl/process.ixx @@ -12,12 +12,16 @@ namespace butl *args0_ = initial; } + // Note that moving the argument into recall and leaving effective empty + // complies with the constructor semantics and also makes sure that the + // move/copy constructors and assignment operators work correctly. + // inline process_path:: process_path (path e) - : effect (std::move (e)), + : recall (std::move (e)), args0_ (nullptr) { - initial = effect.string ().c_str (); + initial = recall.string ().c_str (); } inline process_path:: diff --git a/libbutl/process.mxx b/libbutl/process.mxx index c52869e..fa97ebf 100644 --- a/libbutl/process.mxx +++ b/libbutl/process.mxx @@ -130,8 +130,11 @@ LIBBUTL_MODEXPORT namespace butl void clear_recall (); + // Make all three paths the same. + // explicit process_path (path effect); + process_path (const char* initial, path&& recall, path&& effect); process_path () = default; -- cgit v1.1