Kaydet (Commit) e537d227 authored tarafından Caolán McNamara's avatar Caolán McNamara

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
üst 8af6c125
......@@ -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;
......
......@@ -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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment