diff --git a/src/util/ScopeExit.hxx b/src/util/ScopeExit.hxx index 8dc0e2c70..a53282676 100644 --- a/src/util/ScopeExit.hxx +++ b/src/util/ScopeExit.hxx @@ -43,9 +43,8 @@ public: explicit ScopeExitGuard(F &&f) noexcept:F(std::forward(f)) {} ScopeExitGuard(ScopeExitGuard &&src) noexcept - :F(std::move(src)), enabled(src.enabled) { - src.enabled = false; - } + :F(std::move(src)), + enabled(std::exchange(src.enabled, false)) {} /* destructors are "noexcept" by default; this explicit "noexcept" declaration allows the destructor to throw if