summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jxl/base/scope_guard.h
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/jpeg-xl/lib/jxl/base/scope_guard.h')
-rw-r--r--third_party/jpeg-xl/lib/jxl/base/scope_guard.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/third_party/jpeg-xl/lib/jxl/base/scope_guard.h b/third_party/jpeg-xl/lib/jxl/base/scope_guard.h
index a18a44cb79..f060c5bc1d 100644
--- a/third_party/jpeg-xl/lib/jxl/base/scope_guard.h
+++ b/third_party/jpeg-xl/lib/jxl/base/scope_guard.h
@@ -24,8 +24,8 @@ class ScopeGuard {
}
template <typename CallbackParam>
- explicit ScopeGuard(CallbackParam &&callback)
- : callback_(std::forward<CallbackParam>(callback)), armed_(true) {}
+ ScopeGuard(CallbackParam &&callback, bool armed)
+ : callback_(std::forward<CallbackParam>(callback)), armed_(armed) {}
~ScopeGuard() {
if (armed_) callback_();
@@ -40,7 +40,7 @@ class ScopeGuard {
template <typename Callback>
ScopeGuard<Callback> MakeScopeGuard(Callback &&callback) {
- return ScopeGuard<Callback>{std::forward<Callback>(callback)};
+ return ScopeGuard<Callback>{std::forward<Callback>(callback), true};
}
} // namespace jxl