summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-02-04 09:28:37 +0000
committerCaolán McNamara <caolanm@redhat.com>2015-02-04 11:11:02 +0000
commite537d227d3a801076aff98c113650942fb6b3699 (patch)
tree6bd828b1cfd46b3f21fa58162ec77b421669c52a /sd
parent8af6c125226b55af21efd60edc6ed59a9214fa8c (diff)
hard to find accidental leaks with all the deliberate ones
so make these globals belong to the SfxModule which gets torn down before exit Change-Id: Iad655f8726ba6784a5d606ef469522950906360a
Diffstat (limited to 'sd')
-rw-r--r--sd/inc/sdmod.hxx9
-rw-r--r--sd/source/ui/unoidl/unoobj.cxx22
2 files changed, 17 insertions, 14 deletions
diff --git a/sd/inc/sdmod.hxx b/sd/inc/sdmod.hxx
index d339c09ce2f5..d2a64acb4118 100644
--- a/sd/inc/sdmod.hxx
+++ b/sd/inc/sdmod.hxx
@@ -26,11 +26,13 @@
#include <sot/storage.hxx>
#include <tools/shl.hxx>
#include "sddllapi.h"
+#include <svl/itemprop.hxx>
#include <svl/lstner.hxx>
#include <com/sun/star/text/WritingMode.hpp>
#include <sfx2/module.hxx>
#include <vcl/vclevent.hxx>
#include <sal/types.h>
+#include <boost/ptr_container/ptr_map.hpp>
#include <memory>
class SdOptions;
@@ -58,6 +60,9 @@ 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;
+
/*
This subclass of <SfxModule> (which is a subclass of <SfxShell>) is
@@ -122,6 +127,10 @@ public:
virtual void ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet ) SAL_OVERRIDE;
virtual SfxTabPage* CreateTabPage( sal_uInt16 nId, vcl::Window* pParent, const SfxItemSet& rSet ) SAL_OVERRIDE;
+ SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
+ SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
+ SdTypesCache gImplTypesCache;
+
protected:
SdOptions* pImpressOptions;
diff --git a/sd/source/ui/unoidl/unoobj.cxx b/sd/source/ui/unoidl/unoobj.cxx
index 329dd9836a58..47fe407a4e53 100644
--- a/sd/source/ui/unoidl/unoobj.cxx
+++ b/sd/source/ui/unoidl/unoobj.cxx
@@ -85,13 +85,6 @@ using ::com::sun::star::uno::Any;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::drawing::XShape;
-typedef std::map<sal_uIntPtr, SfxExtItemPropertySetInfo*> SdExtPropertySetInfoCache;
-static SdExtPropertySetInfoCache gImplImpressPropertySetInfoCache;
-static SdExtPropertySetInfoCache gImplDrawPropertySetInfoCache;
-
-typedef std::map<sal_uInt32, uno::Sequence< uno::Type >*> SdTypesCache;
-static SdTypesCache gImplTypesCache;
-
#define WID_EFFECT 1
#define WID_SPEED 2
#define WID_TEXTEFFECT 3
@@ -344,8 +337,9 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
}
else
{
- const sal_uInt32 nObjId = mpShape->getShapeKind();
+ sal_uInt32 nObjId = mpShape->getShapeKind();
uno::Sequence< uno::Type >* pTypes;
+ SdTypesCache& gImplTypesCache = SD_MOD()->gImplTypesCache;
SdTypesCache::iterator aIter( gImplTypesCache.find( nObjId ) );
if( aIter == gImplTypesCache.end() )
{
@@ -354,7 +348,7 @@ uno::Sequence< uno::Type > SAL_CALL SdXShape::getTypes()
pTypes->realloc( nCount+1 );
(*pTypes)[nCount] = cppu::UnoType<lang::XTypeProvider>::get();
- gImplTypesCache[ nObjId ] = pTypes;
+ gImplTypesCache.insert(nObjId, pTypes);
}
else
{
@@ -430,17 +424,17 @@ uno::Any SAL_CALL SdXShape::getPropertyDefault( const OUString& aPropertyName )
sal_uIntPtr nObjId = reinterpret_cast<sal_uIntPtr>(mpShape->getPropertyMapEntries());
SfxExtItemPropertySetInfo* pInfo = NULL;
- SdExtPropertySetInfoCache* pCache = (mpModel && mpModel->IsImpressDocument()) ?
- &gImplImpressPropertySetInfoCache : &gImplDrawPropertySetInfoCache;
+ SdExtPropertySetInfoCache& rCache = (mpModel && mpModel->IsImpressDocument()) ?
+ SD_MOD()->gImplImpressPropertySetInfoCache : SD_MOD()->gImplDrawPropertySetInfoCache;
- SdExtPropertySetInfoCache::iterator aIter( pCache->find( nObjId ) );
- if( aIter == pCache->end() )
+ SdExtPropertySetInfoCache::iterator aIter( rCache.find( nObjId ) );
+ if( aIter == rCache.end() )
{
uno::Reference< beans::XPropertySetInfo > xInfo( mpShape->_getPropertySetInfo() );
pInfo = new SfxExtItemPropertySetInfo( mpMap, xInfo->getProperties() );
pInfo->acquire();
- (*pCache)[ nObjId ] = pInfo;
+ rCache.insert(nObjId, pInfo);
}
else
{