diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx index 7ea00d1fe75c..b4ff13275ae3 100644 --- a/include/sfx2/msgpool.hxx +++ b/include/sfx2/msgpool.hxx @@ -35,9 +35,9 @@ typedef std::vector SfxInterfaceArr_Impl; class SFX2_DLLPUBLIC SfxSlotPool { - SfxSlotGroupArr_Impl* _pGroups; + std::unique_ptr _pGroups; SfxSlotPool* _pParentPool; - SfxInterfaceArr_Impl* _pInterfaces; + std::unique_ptr _pInterfaces; sal_uInt16 _nCurGroup; sal_uInt16 _nCurInterface; sal_uInt16 _nCurMsg; diff --git a/sfx2/source/control/msgpool.cxx b/sfx2/source/control/msgpool.cxx index 1c05652566c9..eb38323424f6 100644 --- a/sfx2/source/control/msgpool.cxx +++ b/sfx2/source/control/msgpool.cxx @@ -34,9 +34,7 @@ #include SfxSlotPool::SfxSlotPool(SfxSlotPool *pParent) - : _pGroups(nullptr) - , _pParentPool( pParent ) - , _pInterfaces(nullptr) + : _pParentPool( pParent ) , _nCurGroup(0) , _nCurInterface(0) , _nCurMsg(0) @@ -48,8 +46,6 @@ SfxSlotPool::~SfxSlotPool() _pParentPool = nullptr; for ( SfxInterface *pIF = FirstInterface(); pIF; pIF = FirstInterface() ) delete pIF; - delete _pInterfaces; - delete _pGroups; } @@ -58,8 +54,8 @@ SfxSlotPool::~SfxSlotPool() void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) { // add to the list of SfxObjectInterface instances - if ( _pInterfaces == nullptr ) - _pInterfaces = new SfxInterfaceArr_Impl; + if(!_pInterfaces) + _pInterfaces.reset(new SfxInterfaceArr_Impl); _pInterfaces->push_back(&rInterface); // Stop at a (single) Null-slot (for syntactic reasons the interfaces @@ -70,7 +66,7 @@ void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) // possibly add Interface-id and group-ids of funcs to the list of groups if ( !_pGroups ) { - _pGroups = new SfxSlotGroupArr_Impl; + _pGroups.reset(new SfxSlotGroupArr_Impl); if ( _pParentPool ) {