diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fxcrt/maybe_owned.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/fxcrt/maybe_owned.h b/core/fxcrt/maybe_owned.h index 130d2bdc3c..d920ea7a91 100644 --- a/core/fxcrt/maybe_owned.h +++ b/core/fxcrt/maybe_owned.h @@ -41,6 +41,11 @@ class MaybeOwned { m_pObj = ptr; m_pOwnedObj.reset(); } + // Helpful for untangling a collection of intertwined MaybeOwned<>. + void ResetIfUnowned() { + if (!IsOwned()) + Reset(); + } T* Get() const { return m_pObj.Get(); } bool IsOwned() const { return !!m_pOwnedObj; } |