diff options
author | bunnei <bunneidev@gmail.com> | 2020-03-31 21:16:07 +0200 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2020-04-17 06:59:28 +0200 |
commit | 4df6ef04ac5e2169bdba67937a0b301f569949d6 (patch) | |
tree | b3341228156641d7e3f9d0aed5b4ab3ff1e8eb07 /src | |
parent | core: memory: Move to Core::Memory namespace. (diff) | |
download | yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.tar yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.tar.gz yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.tar.bz2 yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.tar.lz yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.tar.xz yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.tar.zst yuzu-4df6ef04ac5e2169bdba67937a0b301f569949d6.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/common/scope_exit.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/common/scope_exit.h b/src/common/scope_exit.h index 1176a72b1..68ef5f197 100644 --- a/src/common/scope_exit.h +++ b/src/common/scope_exit.h @@ -12,10 +12,17 @@ template <typename Func> struct ScopeExitHelper { explicit ScopeExitHelper(Func&& func) : func(std::move(func)) {} ~ScopeExitHelper() { - func(); + if (active) { + func(); + } + } + + void Cancel() { + active = false; } Func func; + bool active{true}; }; template <typename Func> |