diff --git a/BAN/include/BAN/ScopeGuard.h b/BAN/include/BAN/ScopeGuard.h index d39c12bde9..185262913c 100644 --- a/BAN/include/BAN/ScopeGuard.h +++ b/BAN/include/BAN/ScopeGuard.h @@ -13,10 +13,16 @@ namespace BAN { } ~ScopeGuard() { - m_func(); + if (m_enabled) + m_func(); + } + void disable() + { + m_enabled = false; } private: BAN::Function m_func; + bool m_enabled { true }; }; } \ No newline at end of file