X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/011ad05168e653e686c711ab6356d18b984405c8..ca77701441e39245dcbfce903049e76f166979e5:/include/wx/scopeguard.h diff --git a/include/wx/scopeguard.h b/include/wx/scopeguard.h index a68c9896d8..434c89768d 100644 --- a/include/wx/scopeguard.h +++ b/include/wx/scopeguard.h @@ -390,7 +390,7 @@ namespace wxPrivate { // empty class just to be able to define a reference to it -class VariableSetterBase { }; +class VariableSetterBase : public wxScopeGuardImplBase { }; typedef const VariableSetterBase& VariableSetter; @@ -404,10 +404,9 @@ public: { } - ~VariableSetterImpl() - { - m_var = m_value; - } + ~VariableSetterImpl() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_var = m_value; } private: T& m_var; @@ -426,10 +425,9 @@ public: { } - ~VariableNullerImpl() - { - m_var = NULL; - } + ~VariableNullerImpl() { wxPrivateOnScopeExit(*this); } + + void Execute() { m_var = NULL; } private: T& m_var;