[Libreoffice-commits] core.git: sw/inc sw/source

Bjoern Michaelsen bjoern.michaelsen at canonical.com
Tue Feb 28 09:00:40 UTC 2017


 sw/inc/dcontact.hxx              |    1 -
 sw/source/core/draw/dcontact.cxx |   21 ++-------------------
 2 files changed, 2 insertions(+), 20 deletions(-)

New commits:
commit 23979c1d81b5aa6efae7c103ba24a024b6cdf64a
Author: Bjoern Michaelsen <bjoern.michaelsen at canonical.com>
Date:   Mon Feb 27 23:00:36 2017 +0100

    remove DestroyVirtObj member
    
    - had only one caller
    - didnt even do what it claimed in the comments (removing from
      container), so removed to a simple delete statements with pointless
      noop decorum
    
    Change-Id: I3eeaebbc6199a516b24106d3c2fc27a3067cb34d
    Reviewed-on: https://gerrit.libreoffice.org/34703
    Reviewed-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>
    Tested-by: Björn Michaelsen <bjoern.michaelsen at canonical.com>

diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 91800c4..a92656a 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -368,7 +368,6 @@ class SwDrawContact final : public SwContact
 
         /// method for adding/removing 'virtual' drawing object.
         SwDrawVirtObj* CreateVirtObj();
-        static void DestroyVirtObj( SwDrawVirtObj* pVirtObj );
         void RemoveAllVirtObjs();
 
         void InvalidateObjs_( const bool _bUpdateSortedObjsList = false );
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index f8a5eb0..c40cd50 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -764,20 +764,6 @@ SwDrawVirtObj* SwDrawContact::CreateVirtObj()
     return pNewDrawVirtObj;
 }
 
-/** destroys a given 'virtual' drawing object.
- *
- * side effect: 'virtual' drawing object is removed from data structure
- *              <maDrawVirtObjs>.
- */
-void SwDrawContact::DestroyVirtObj( SwDrawVirtObj* _pVirtObj )
-{
-    if ( _pVirtObj )
-    {
-        delete _pVirtObj;
-        _pVirtObj = nullptr;
-    }
-}
-
 /** add a 'virtual' drawing object to drawing page.
  *
  * Use an already created one, which isn't used, or create a new one.
@@ -809,15 +795,12 @@ SwDrawVirtObj* SwDrawContact::AddVirtObj()
 /// remove 'virtual' drawing objects and destroy them.
 void SwDrawContact::RemoveAllVirtObjs()
 {
-    for ( std::list<SwDrawVirtObj*>::iterator aDrawVirtObjsIter = maDrawVirtObjs.begin();
-          aDrawVirtObjsIter != maDrawVirtObjs.end();
-          ++aDrawVirtObjsIter )
+    for(auto& pDrawVirtObj : maDrawVirtObjs)
     {
         // remove and destroy 'virtual object'
-        SwDrawVirtObj* pDrawVirtObj = (*aDrawVirtObjsIter);
         pDrawVirtObj->RemoveFromWriterLayout();
         pDrawVirtObj->RemoveFromDrawingPage();
-        DestroyVirtObj( pDrawVirtObj );
+        delete pDrawVirtObj;
     }
     maDrawVirtObjs.clear();
 }


More information about the Libreoffice-commits mailing list