diff options
author | Caolán McNamara <caolanm@redhat.com> | 2015-09-21 13:37:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-09-21 19:34:16 +0000 |
commit | 599fab44ad2ca626f046b9e9e4924110950a897c (patch) | |
tree | 4304f1e7f0ab68f88b105f5779b8ec619e176c12 /include/vcl/vclptr.hxx | |
parent | da4c217ac49ff05e352c0e6e46a46a4e9a0b78cc (diff) |
hide ScopedPtr::reset and add disposeAndClear
Change-Id: I55d6e789abd408b8478a2b9ae141d8899af2c309
Reviewed-on: https://gerrit.libreoffice.org/18745
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'include/vcl/vclptr.hxx')
-rw-r--r-- | include/vcl/vclptr.hxx | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/include/vcl/vclptr.hxx b/include/vcl/vclptr.hxx index 6618ec20ae87..2614886e9723 100644 --- a/include/vcl/vclptr.hxx +++ b/include/vcl/vclptr.hxx @@ -313,10 +313,18 @@ public: /** Assignment that releases the last reference. */ - inline ScopedVclPtr<reference_type>& operator= (reference_type * pBody) + inline void disposeAndReset(reference_type *pBody) { VclPtr<reference_type>::disposeAndClear(); VclPtr<reference_type>::set(pBody); + } + + /** + Assignment that releases the last reference. + */ + inline ScopedVclPtr<reference_type>& operator= (reference_type * pBody) + { + disposeAndReset(pBody); return *this; } @@ -347,6 +355,9 @@ private: ScopedVclPtr (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION; // And certainly we don't want a default assignment operator. ScopedVclPtr<reference_type>& operator= (const ScopedVclPtr<reference_type> &) SAL_DELETED_FUNCTION; + // And disallow reset as that doesn't call disposeAndClear on the original reference + void reset() SAL_DELETED_FUNCTION; + void reset(reference_type *pBody) SAL_DELETED_FUNCTION; protected: inline ScopedVclPtr (reference_type * pBody, __sal_NoAcquire) |