diff options
author | Xisco Fauli <anistenis@gmail.com> | 2016-06-01 01:54:04 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-06-01 07:01:12 +0000 |
commit | d080fb811d23fe4d4a3bb2efd079cc9446709f73 (patch) | |
tree | c3629055de32083978ec6f8aeb92cf7490368993 | |
parent | 2ba7893243fff5d6fbd0b706368877b7a5123569 (diff) |
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>
-rw-r--r-- | include/sfx2/msgpool.hxx | 4 | ||||
-rw-r--r-- | sfx2/source/control/msgpool.cxx | 12 |
2 files changed, 6 insertions, 10 deletions
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<SfxInterface*> SfxInterfaceArr_Impl; class SFX2_DLLPUBLIC SfxSlotPool { - SfxSlotGroupArr_Impl* _pGroups; + std::unique_ptr<SfxSlotGroupArr_Impl> _pGroups; SfxSlotPool* _pParentPool; - SfxInterfaceArr_Impl* _pInterfaces; + std::unique_ptr<SfxInterfaceArr_Impl> _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 <sfx2/sfx.hrc> 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 ) { |