diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-09 14:35:25 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-12 08:36:20 +0200 |
commit | d4eabd5da8ea3b5ac40659c22cde19b26b3c002b (patch) | |
tree | 63c93e0287aa5668d8b2147b756d08ced533e7fd /svx/source | |
parent | 089ff7a374df9870c506c36720a1b9cab3a252f6 (diff) |
pass comphelper::PropertySetInfo around using rtl::Reference
and remove some manual ref counting
Change-Id: Ib78122fbbf914e87e0aef1f8fffe3952639e5b22
Reviewed-on: https://gerrit.libreoffice.org/38607
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/unodraw/unoprov.cxx | 10 | ||||
-rw-r--r-- | svx/source/unogallery/unogalitem.cxx | 10 | ||||
-rw-r--r-- | svx/source/unogallery/unogalitem.hxx | 2 |
3 files changed, 6 insertions, 16 deletions
diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index f0d5a1f4a686..c3cb7b9a23f3 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -1334,15 +1334,11 @@ OUString SvxUnogetInternalNameForItem(const sal_Int16 nWhich, const OUString& rA } -comphelper::PropertySetInfo* SvxPropertySetInfoPool::getOrCreate( sal_Int32 nServiceId ) throw() +rtl::Reference<comphelper::PropertySetInfo> const & SvxPropertySetInfoPool::getOrCreate( sal_Int32 nServiceId ) throw() { SolarMutexGuard aGuard; - if( nServiceId > SVXUNO_SERVICEID_LASTID ) - { - OSL_FAIL( "unknown service id!" ); - return nullptr; - } + assert( nServiceId <= SVXUNO_SERVICEID_LASTID ); if( !mxInfos[ nServiceId ].is() ) { @@ -1365,7 +1361,7 @@ comphelper::PropertySetInfo* SvxPropertySetInfoPool::getOrCreate( sal_Int32 nSer } } - return mxInfos[ nServiceId ].get(); + return mxInfos[ nServiceId ]; } rtl::Reference<comphelper::PropertySetInfo> SvxPropertySetInfoPool::mxInfos[SVXUNO_SERVICEID_LASTID+1] = { nullptr }; diff --git a/svx/source/unogallery/unogalitem.cxx b/svx/source/unogallery/unogalitem.cxx index 6de4a988eb41..8377690808eb 100644 --- a/svx/source/unogallery/unogalitem.cxx +++ b/svx/source/unogallery/unogalitem.cxx @@ -178,11 +178,8 @@ sal_Int8 SAL_CALL GalleryItem::getType() } -::comphelper::PropertySetInfo* GalleryItem::createPropertySetInfo() +rtl::Reference<::comphelper::PropertySetInfo> GalleryItem::createPropertySetInfo() { - SolarMutexGuard aGuard; - ::comphelper::PropertySetInfo* pRet = new ::comphelper::PropertySetInfo(); - static ::comphelper::PropertyMapEntry const aEntries[] = { { OUString("GalleryItemType"), UNOGALLERY_GALLERYITEMTYPE, cppu::UnoType<sal_Int8>::get(), @@ -206,10 +203,7 @@ sal_Int8 SAL_CALL GalleryItem::getType() { OUString(), 0, css::uno::Type(), 0, 0 } }; - pRet->acquire(); - pRet->add( aEntries ); - - return pRet; + return rtl::Reference<::comphelper::PropertySetInfo>( new ::comphelper::PropertySetInfo( aEntries ) ); } void GalleryItem::_setPropertyValues( const comphelper::PropertyMapEntry** ppEntries, const uno::Any* pValues ) diff --git a/svx/source/unogallery/unogalitem.hxx b/svx/source/unogallery/unogalitem.hxx index 54dbcd2369b9..bd1f66958767 100644 --- a/svx/source/unogallery/unogalitem.hxx +++ b/svx/source/unogallery/unogalitem.hxx @@ -75,7 +75,7 @@ protected: protected: - static ::comphelper::PropertySetInfo* createPropertySetInfo(); + static rtl::Reference<::comphelper::PropertySetInfo> createPropertySetInfo(); private: |