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

Tor Lillqvist tml at iki.fi
Thu Apr 11 00:05:26 PDT 2013


 sd/source/ui/dlg/PhotoAlbumDialog.cxx |   12 ++++--------
 sfx2/source/appl/newhelp.cxx          |    2 --
 2 files changed, 4 insertions(+), 10 deletions(-)

New commits:
commit 4a41d3b36b06c6f71fd9a2d742933888980313c5
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Apr 11 09:32:01 2013 +0300

    Fix warning: unused variable 'PROP_LAYOUT_MANAGER' [loplugin]
    
    Change-Id: Ifd475718766a772504da9e522894b90d7e63347a

diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx
index 5078c95..5ccb89b 100644
--- a/sfx2/source/appl/newhelp.cxx
+++ b/sfx2/source/appl/newhelp.cxx
@@ -2006,8 +2006,6 @@ long TextWin_Impl::Notify( NotifyEvent& rNEvt )
 // remove docking area acceptor from layoutmanager, so it will not layout anything further .-)
 static void lcl_disableLayoutOfFrame(const Reference< XFrame2 >& xFrame)
 {
-    static const OUString PROP_LAYOUT_MANAGER("LayoutManager");
-
     xFrame->setLayoutManager( Reference< XLayoutManager >() );
 }
 
commit c744ff638f778e641ea7ee37d4700c946af5a45e
Author: Tor Lillqvist <tml at iki.fi>
Date:   Thu Apr 11 09:20:24 2013 +0300

    It's fine to delete a NULL pointer
    
    Calling delete on a NULL pointer does nothing. Checking for non-NULL just
    clutters the code.
    
    Still, I wonder if this code has some issues with heap corruption and/or
    leaks. The pImagesLst->GetEntryData() calls just return a copy of the OUString
    pointers stored in some kind of list, right? So is it correct to call delete
    on the copy, but keep the pointer in the list intact, which thus then will be
    pointing to freed memory, won't it? Or will the code automatically work in
    such a way that all pointers in the list will be handled exactly once (and
    deleted)?
    
    Perhaps running this under valgrind would be a good idea.
    
    Change-Id: Ibf401cc44caaeea6bb46f38cd9851ac14b2d2545

diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 1d36f38..374b305 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -179,8 +179,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
                 }
             }
-            if (pData)
-                delete pData;
+            delete pData;
         }
         else if( sOpt == "1 image with title" )
         {
@@ -222,8 +221,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     appendNewSlide(AUTOLAYOUT_ONLY_TEXT, xDrawPages);
                 }
             }
-            if (pData)
-                delete pData;
+            delete pData;
         }
         else if( sOpt == "2 images" )
         {
@@ -335,8 +333,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                 }
 
             }
-            if (pData)
-                delete pData;
+            delete pData;
         }
         else if( sOpt == "4 images" )
         {
@@ -542,8 +539,7 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl)
                     xSlide->add(xShape);
                 }
             }
-            if (pData)
-                delete pData;
+            delete pData;
         }
         else
         {


More information about the Libreoffice-commits mailing list