Don't rely on RVO in wxON_BLOCK_EXIT_SET().
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Apr 2011 13:14:47 +0000 (13:14 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Apr 2011 13:14:47 +0000 (13:14 +0000)
commitaef081f465d68fabbf9e7abc0c57ea745b6fd55a
tree96a796b34ab1b7d48593ef38402061d4b536d3f4
parentda87ce5a36c80e5e049bb8a35c29c4990064206b
Don't rely on RVO in wxON_BLOCK_EXIT_SET().

MakeVarSetter() relies on the compiler always using RVO, as
VariableSetterImpl<> doesn't have correct copy ctor; worse yet, its use
wasn't detected at compile time.  With some compilers (e.g. VC++ 2008
with non-trivial variable types), this resulted in the variable being
reset too soon, immediately in the place where the macro was used.
Fixed by using the same technique already used in wxScopeGuardImpl. In
fact, VariableSetterImpl is just another special case of
wxScopeGuardImpl, so just derive from the latter.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67592 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
include/wx/scopeguard.h