manage SvxPropertySetInfoPool.mpInfos with rtl::Reference

instead of with manual acquire()

Change-Id: I9fac619730df6a070c5f0d887ecf9249bd7d65a6
This commit is contained in:
Noel Grandin
2017-01-17 11:11:05 +02:00
parent ce0f9962d1
commit 3b395bc73f
2 changed files with 10 additions and 10 deletions

View File

@@ -25,6 +25,7 @@
#include <svl/itemprop.hxx>
#include <svx/svxdllapi.h>
#include <editeng/unoipset.hxx>
#include <rtl/ref.hxx>
class SvxItemPropertySet;
@@ -116,7 +117,7 @@ public:
SVX_DLLPUBLIC static comphelper::PropertySetInfo* getOrCreate( sal_Int32 nServiceId ) throw();
private:
static comphelper::PropertySetInfo* mpInfos[SVXUNO_SERVICEID_LASTID+1];
static rtl::Reference<comphelper::PropertySetInfo> mxInfos[SVXUNO_SERVICEID_LASTID+1];
};
#endif

View File

@@ -1375,21 +1375,20 @@ comphelper::PropertySetInfo* SvxPropertySetInfoPool::getOrCreate( sal_Int32 nSer
return nullptr;
}
if( mpInfos[ nServiceId ] == nullptr )
if( !mxInfos[ nServiceId ].is() )
{
mpInfos[nServiceId] = new comphelper::PropertySetInfo();
mpInfos[nServiceId]->acquire();
mxInfos[nServiceId] = new comphelper::PropertySetInfo();
switch( nServiceId )
{
case SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS:
mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS]->add( ImplGetSvxDrawingDefaultsPropertyMap() );
mxInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS]->add( ImplGetSvxDrawingDefaultsPropertyMap() );
break;
case SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER:
mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->add( ImplGetSvxDrawingDefaultsPropertyMap() );
mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->remove( UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION );
mxInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->add( ImplGetSvxDrawingDefaultsPropertyMap() );
mxInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->remove( UNO_NAME_EDIT_PARA_IS_HANGING_PUNCTUATION );
// OD 13.10.2003 #i18732# - add property map for writer item 'IsFollowingTextFlow'
mpInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->add( ImplGetAdditionalWriterDrawingDefaultsPropertyMap() );
mxInfos[SVXUNO_SERVICEID_COM_SUN_STAR_DRAWING_DEFAULTS_WRITER]->add( ImplGetAdditionalWriterDrawingDefaultsPropertyMap() );
break;
default:
@@ -1397,9 +1396,9 @@ comphelper::PropertySetInfo* SvxPropertySetInfoPool::getOrCreate( sal_Int32 nSer
}
}
return mpInfos[ nServiceId ];
return mxInfos[ nServiceId ].get();
}
comphelper::PropertySetInfo* SvxPropertySetInfoPool::mpInfos[SVXUNO_SERVICEID_LASTID+1] = { nullptr };
rtl::Reference<comphelper::PropertySetInfo> SvxPropertySetInfoPool::mxInfos[SVXUNO_SERVICEID_LASTID+1] = { nullptr };
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */