diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-13 10:50:22 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-13 11:58:10 +0200 |
commit | dbf8ad9bc385411c349095dfa66345464b4215d6 (patch) | |
tree | 507ac08bf144fa8ac44ad4889ce127cb0d0c70c7 /basic | |
parent | b0e2dbca5164c494a669bd48f8ff058f4c1ad710 (diff) |
loplugin:useuniqueptr in SbUnoStructRefObject
now that we have upgraded to VS2017, we can use std::unique_ptr in
std::map
Change-Id: Id01af07ccae7447405b8f0bc44b08043f453e54b
Reviewed-on: https://gerrit.libreoffice.org/57384
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/classes/sbunoobj.cxx | 5 | ||||
-rw-r--r-- | basic/source/inc/sbunoobj.hxx | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 5eda97d08856..ddf92c07638b 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -20,6 +20,7 @@ #include <sal/config.h> #include <o3tl/any.hxx> +#include <o3tl/make_unique.hxx> #include <osl/mutex.hxx> #include <vcl/svapp.hxx> #include <vcl/errcode.hxx> @@ -4636,8 +4637,6 @@ SbUnoStructRefObject::SbUnoStructRefObject( const OUString& aName_, const Struct SbUnoStructRefObject::~SbUnoStructRefObject() { - for (auto const& field : maFields) - delete field.second; } void SbUnoStructRefObject::initMemberCache() @@ -4659,7 +4658,7 @@ void SbUnoStructRefObject::initMemberCache() for ( sal_Int32 nPos = pCompTypeDescr->nMembers; nPos--; ) { OUString aName( ppNames[nPos] ); - maFields[ aName ] = new StructRefInfo( maMemberInfo.getRootAnyRef(), ppTypeRefs[nPos], maMemberInfo.getPos() + pMemberOffsets[nPos] ); + maFields[ aName ] = o3tl::make_unique<StructRefInfo>( maMemberInfo.getRootAnyRef(), ppTypeRefs[nPos], maMemberInfo.getPos() + pMemberOffsets[nPos] ); } } typelib_typedescription_release(pTD); diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx index 2df319ffbb21..d9c654b77d23 100644 --- a/basic/source/inc/sbunoobj.hxx +++ b/basic/source/inc/sbunoobj.hxx @@ -71,7 +71,7 @@ class SbUnoStructRefObject: public SbxObject return rProp.compareToIgnoreAsciiCase( rOtherProp ) < 0; } }; - typedef std::map< OUString, StructRefInfo*, caseLessComp > StructFieldInfo; + typedef std::map< OUString, std::unique_ptr<StructRefInfo>, caseLessComp > StructFieldInfo; StructFieldInfo maFields; StructRefInfo maMemberInfo; bool mbMemberCacheInit; |