summaryrefslogtreecommitdiff
path: root/forms
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-05-22 13:25:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-05-23 09:31:20 +0200
commitd1e47b1428abf1732ab4d5e219b210760d4152e0 (patch)
tree8eac1def834ba548c45a8a1a18e8e39d45eedc1d /forms
parent919a4ef592b6026a7533a93682f39118fef29ce8 (diff)
enhance useuniqueptr loplugin
teach it to look for the following sequence in a destructor: delete m_pfoo; m_pfoo = nullptr; Change-Id: Icd6271a63a024e32b53cc9e599f8f59952160380 Reviewed-on: https://gerrit.libreoffice.org/37900 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'forms')
-rw-r--r--forms/source/component/propertybaghelper.cxx11
-rw-r--r--forms/source/inc/propertybaghelper.hxx4
2 files changed, 7 insertions, 8 deletions
diff --git a/forms/source/component/propertybaghelper.cxx b/forms/source/component/propertybaghelper.cxx
index ab73d42b575d..49a10ee95a99 100644
--- a/forms/source/component/propertybaghelper.cxx
+++ b/forms/source/component/propertybaghelper.cxx
@@ -80,8 +80,6 @@ namespace frm
PropertyBagHelper::~PropertyBagHelper()
{
- delete m_pPropertyArrayHelper;
- m_pPropertyArrayHelper = nullptr;
}
@@ -100,8 +98,7 @@ namespace frm
void PropertyBagHelper::impl_nts_invalidatePropertySetInfo()
{
- delete m_pPropertyArrayHelper;
- m_pPropertyArrayHelper = nullptr;
+ m_pPropertyArrayHelper.reset();
}
@@ -146,11 +143,11 @@ namespace frm
::comphelper::OPropertyArrayAggregationHelper& PropertyBagHelper::impl_ts_getArrayHelper() const
{
- OPropertyArrayAggregationHelper* p = m_pPropertyArrayHelper;
+ OPropertyArrayAggregationHelper* p = m_pPropertyArrayHelper.get();
if ( !p )
{
::osl::MutexGuard aGuard( m_rContext.getMutex() );
- p = m_pPropertyArrayHelper;
+ p = m_pPropertyArrayHelper.get();
if ( !p )
{
// our own fixed and our aggregate's properties
@@ -167,7 +164,7 @@ namespace frm
p = new OPropertyArrayAggregationHelper( aOwnProps, aAggregateProps, &lcl_getPropertyInfos(), NEW_HANDLE_BASE );
OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
- const_cast< PropertyBagHelper* >( this )->m_pPropertyArrayHelper = p;
+ const_cast< PropertyBagHelper* >( this )->m_pPropertyArrayHelper.reset( p );
}
} // if ( !p )
else
diff --git a/forms/source/inc/propertybaghelper.hxx b/forms/source/inc/propertybaghelper.hxx
index f4ca932704ef..e3d86b3673a7 100644
--- a/forms/source/inc/propertybaghelper.hxx
+++ b/forms/source/inc/propertybaghelper.hxx
@@ -24,6 +24,7 @@
#include <comphelper/propertybag.hxx>
#include <comphelper/propagg.hxx>
+#include <memory>
namespace frm
@@ -53,7 +54,8 @@ namespace frm
{
private:
IPropertyBagHelperContext& m_rContext;
- ::comphelper::OPropertyArrayAggregationHelper* m_pPropertyArrayHelper;
+ std::unique_ptr<::comphelper::OPropertyArrayAggregationHelper>
+ m_pPropertyArrayHelper;
::comphelper::PropertyBag m_aDynamicProperties;
bool m_bDisposed;