tdf#89329: use unique_ptr for pImpl in msgpool

Change-Id: I97f7deab763b4da8e267e871cb78d0547711e777
Reviewed-on: https://gerrit.libreoffice.org/25751
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
This commit is contained in:
Xisco Fauli
2016-06-01 01:54:04 +02:00
committed by Noel Grandin
parent 2ba7893243
commit d080fb811d
2 changed files with 6 additions and 10 deletions

View File

@@ -35,9 +35,9 @@ typedef std::vector<SfxInterface*> SfxInterfaceArr_Impl;
class SFX2_DLLPUBLIC SfxSlotPool class SFX2_DLLPUBLIC SfxSlotPool
{ {
SfxSlotGroupArr_Impl* _pGroups; std::unique_ptr<SfxSlotGroupArr_Impl> _pGroups;
SfxSlotPool* _pParentPool; SfxSlotPool* _pParentPool;
SfxInterfaceArr_Impl* _pInterfaces; std::unique_ptr<SfxInterfaceArr_Impl> _pInterfaces;
sal_uInt16 _nCurGroup; sal_uInt16 _nCurGroup;
sal_uInt16 _nCurInterface; sal_uInt16 _nCurInterface;
sal_uInt16 _nCurMsg; sal_uInt16 _nCurMsg;

View File

@@ -34,9 +34,7 @@
#include <sfx2/sfx.hrc> #include <sfx2/sfx.hrc>
SfxSlotPool::SfxSlotPool(SfxSlotPool *pParent) SfxSlotPool::SfxSlotPool(SfxSlotPool *pParent)
: _pGroups(nullptr) : _pParentPool( pParent )
, _pParentPool( pParent )
, _pInterfaces(nullptr)
, _nCurGroup(0) , _nCurGroup(0)
, _nCurInterface(0) , _nCurInterface(0)
, _nCurMsg(0) , _nCurMsg(0)
@@ -48,8 +46,6 @@ SfxSlotPool::~SfxSlotPool()
_pParentPool = nullptr; _pParentPool = nullptr;
for ( SfxInterface *pIF = FirstInterface(); pIF; pIF = FirstInterface() ) for ( SfxInterface *pIF = FirstInterface(); pIF; pIF = FirstInterface() )
delete pIF; delete pIF;
delete _pInterfaces;
delete _pGroups;
} }
@@ -58,8 +54,8 @@ SfxSlotPool::~SfxSlotPool()
void SfxSlotPool::RegisterInterface( SfxInterface& rInterface ) void SfxSlotPool::RegisterInterface( SfxInterface& rInterface )
{ {
// add to the list of SfxObjectInterface instances // add to the list of SfxObjectInterface instances
if ( _pInterfaces == nullptr ) if(!_pInterfaces)
_pInterfaces = new SfxInterfaceArr_Impl; _pInterfaces.reset(new SfxInterfaceArr_Impl);
_pInterfaces->push_back(&rInterface); _pInterfaces->push_back(&rInterface);
// Stop at a (single) Null-slot (for syntactic reasons the interfaces // 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 // possibly add Interface-id and group-ids of funcs to the list of groups
if ( !_pGroups ) if ( !_pGroups )
{ {
_pGroups = new SfxSlotGroupArr_Impl; _pGroups.reset(new SfxSlotGroupArr_Impl);
if ( _pParentPool ) if ( _pParentPool )
{ {