summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-02-05 12:40:29 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-02-05 12:47:23 +0100
commit7078f667a3e39601c6d135e311de67fbab289a2b (patch)
tree2cfdaf2d8c95f5d82d09a33f92c4d52fdd85250c /sd
parent0f86834bd5e2f8d8c7c7880c6f97273d45c599de (diff)
Don't hold refcounted objects by naked pointer
(and no need to hold css::uno::Sequence objects by pointer either). Regression from e537d227d3a801076aff98c113650942fb6b3699 "hard to find accidental leaks with all the deliberate ones" caused JunitTest_svx_unoapi to sometimes crash. Change-Id: I3579c4bbac58d7e341c8acb52dd3f0f06f7b2245
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/sdmod.hxx7
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx26
2 files changed, 16 insertions, 17 deletions
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index d2a64acb4118..d3ae1b2882e1 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -23,6 +23,7 @@
#include "glob.hxx"
#include "pres.hxx"
+#include <rtl/ref.hxx>
#include <sot/storage.hxx>
#include <tools/shl.hxx>
#include "sddllapi.h"
@@ -32,7 +33,7 @@
#include <sfx2/module.hxx>
#include <vcl/vclevent.hxx>
#include <sal/types.h>
-#include <boost/ptr_container/ptr_map.hpp>
+#include <map>
#include <memory>
class SdOptions;
@@ -60,8 +61,8 @@ enum SdOptionStreamMode
SD_OPTION_STORE = 1
};
-typedef boost::ptr_map< sal_uIntPtr, SfxExtItemPropertySetInfo > SdExtPropertySetInfoCache;
-typedef boost::ptr_map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
+typedef std::map< sal_uIntPtr, rtl::Reference<SfxExtItemPropertySetInfo> > SdExtPropertySetInfoCache;
+typedef std::map< sal_uInt32, css::uno::Sequence< css::uno::Type> > SdTypesCache;
/*
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 47fe407a4e53..59aeaa2d29e9 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -19,7 +19,7 @@
#include <sal/config.h>
-#include <map>
+#include <utility>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/presentation/ClickAction.hpp>
@@ -338,24 +338,24 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
else
{
sal_uInt32 nObjId = mpShape->getShapeKind();
- uno::Sequence< uno::Type >* pTypes;
+ uno::Sequence< uno::Type > aTypes;
SdTypesCache& gImplTypesCache = SD_MOD()->gImplTypesCache;
SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
if( aIter == gImplTypesCache.end() )
{
- pTypes = new uno::Sequence< uno::Type >( mpShape->_getTypes() );
- sal_uInt32 nCount = pTypes->getLength();
- pTypes->realloc( nCount+1 );
- (*pTypes)[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
+ aTypes = mpShape->_getTypes();
+ sal_uInt32 nCount = aTypes.getLength();
+ aTypes.realloc( nCount+1 );
+ aTypes[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
- gImplTypesCache.insert(nObjId, pTypes);
+ gImplTypesCache.insert(std::make_pair(nObjId, aTypes));
}
else
{
// use the already computed implementation id
- pTypes = (*aIter).second;
+ aTypes = (*aIter).second;
}
- return *pTypes;
+ return aTypes;
}
}
@@ -422,7 +422,7 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
throw(::com::sun::star::uno::RuntimeException)
{
sal_uIntPtr nObjId = reinterpret_cast<sal_uIntPtr>(mpShape->getPropertyMapEntries());
- SfxExtItemPropertySetInfo* pInfo = NULL;
+ rtl::Reference<SfxExtItemPropertySetInfo> pInfo;
SdExtPropertySetInfoCache& rCache = (mpModel && mpModel->IsImpressDocument()) ?
SD_MOD()->gImplImpressPropertySetInfoCache : SD_MOD()->gImplDrawPropertySetInfoCache;
@@ -432,9 +432,8 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
{
uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
- pInfo->acquire();
- rCache.insert(nObjId, pInfo);
+ rCache.insert(std::make_pair(nObjId, pInfo));
}
else
{
@@ -442,8 +441,7 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
pInfo = (*aIter).second;
}
- uno::Reference< beans::XPropertySetInfo > xInfo( pInfo );
- return pInfo;
+ return pInfo.get();
}
void SAL_CALL SdXShape::setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )