Common/ScopeGuard: Fix move constructor.
This commit is contained in:
1 parent
bd07d9dfd3
commit
1b63776f2d
1 file changed
+1
-4
@@ -13,10 +13,7 @@ class ScopeGuard final
|
|||||||
public:
|
public:
|
||||||
ScopeGuard(Callable&& finalizer) : m_finalizer(std::forward<Callable>(finalizer)) {}
|
ScopeGuard(Callable&& finalizer) : m_finalizer(std::forward<Callable>(finalizer)) {}
|
||||||
|
|
||||||
ScopeGuard(ScopeGuard&& other) : m_finalizer(std::move(other.m_finalizer))
|
ScopeGuard(ScopeGuard&& other) : m_finalizer(std::move(other.m_finalizer)) { other.Dismiss(); }
|
||||||
{
|
|
||||||
other.m_finalizer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
~ScopeGuard() { Exit(); }
|
~ScopeGuard() { Exit(); }
|
||||||
void Dismiss() { m_finalizer.reset(); }
|
void Dismiss() { m_finalizer.reset(); }
|
||||||
|
|||||||
Reference in new issue
Block a user