[Libreoffice-commits] core.git: include/sfx2 sfx2/source

Xisco Fauli anistenis at gmail.com
Wed Jun 1 07:01:51 UTC 2016


 include/sfx2/msgpool.hxx        |    4 ++--
 sfx2/source/control/msgpool.cxx |   12 ++++--------
 2 files changed, 6 insertions(+), 10 deletions(-)

New commits:
commit d080fb811d23fe4d4a3bb2efd079cc9446709f73
Author: Xisco Fauli <anistenis at gmail.com>
Date:   Wed Jun 1 01:54:04 2016 +0200

    tdf#89329: use unique_ptr for pImpl in msgpool
    
    Change-Id: I97f7deab763b4da8e267e871cb78d0547711e777
    Reviewed-on: https://gerrit.libreoffice.org/25751
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noelgrandin at gmail.com>

diff --git a/include/sfx2/msgpool.hxx b/include/sfx2/msgpool.hxx
index 7ea00d1..b4ff132 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 1c05652..eb38323 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 )
         {


More information about the Libreoffice-commits mailing list