diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-05-30 18:19:34 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-05-30 18:19:34 +0200 |
commit | ac5ff992409944f6d2f828290b574261a691a0ed (patch) | |
tree | 0a87284883145b1b9aa3885fb080e84e812f8e23 /include | |
parent | c1a7994d64648c222de2785ca5f30c549ba3443c (diff) |
Dispose pDlgInterface member during destruction
Requires a VclPtr -> ScopedVclPtr assignment operator, similar to the existing
VclPtr -> ScopedVclPtr constructor.
Change-Id: I2b43967ee84f90eea20f8eaa17741229473752b1
Diffstat (limited to 'include')
-rw-r--r-- | include/vcl/vclptr.hxx | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index f809176a77d4..a11552635082 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -347,6 +347,22 @@ public: { } + /** Up-casting assignment operator. + + Does not work for up-casts to ambiguous bases. + + @param rRef another VclPtr + */ + template<typename derived_type> + typename std::enable_if< + std::is_base_of<reference_type, derived_type>::value, + ScopedVclPtr &>::type + operator =(VclPtr<derived_type> const & rRef) + { + disposeAndReset(rRef.get()); + return *this; + } + /** * Override and disallow this, to prevent people accidentally calling it and actually * getting VclPtr::Create and getting a naked VclPtr<> instance |