[Libreoffice-commits] .: sd/inc sd/source

Ivan Timofeev ivantimofeev at kemper.freedesktop.org
Tue Jan 31 09:52:28 PST 2012


 sd/inc/cusshow.hxx                    |    1 +
 sd/source/core/cusshow.cxx            |    7 ++++++-
 sd/source/core/drawdoc_animations.cxx |    6 +-----
 sd/source/ui/unoidl/unocpres.cxx      |   10 ++++++++--
 4 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit f2e17f8f6b6724d7e56d6583d79434372f6221bd
Author: Ivan Timofeev <timofeev.i.s at gmail.com>
Date:   Tue Jan 31 21:38:43 2012 +0400

    erase garbage after std::remove
    
    this fixes commit 5a71069339b3a3c118f3015d978799ef66db7564

diff --git a/sd/inc/cusshow.hxx b/sd/inc/cusshow.hxx
index 1bd3614..74c6cfa 100644
--- a/sd/inc/cusshow.hxx
+++ b/sd/inc/cusshow.hxx
@@ -71,6 +71,7 @@ public:
 
     PageVec& PagesVector();
     void ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage );
+    void RemovePage( const SdPage* pPage );
 
     void   SetName(const String& rName);
     String GetName() const;
diff --git a/sd/source/core/cusshow.cxx b/sd/source/core/cusshow.cxx
index dcdb343..d3233b7 100644
--- a/sd/source/core/cusshow.cxx
+++ b/sd/source/core/cusshow.cxx
@@ -106,7 +106,7 @@ void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage )
 {
     if( !pNewPage )
     {
-        ::std::remove(maPages.begin(), maPages.end(), pOldPage);
+        RemovePage(pOldPage);
     }
     else
     {
@@ -114,6 +114,11 @@ void SdCustomShow::ReplacePage( const SdPage* pOldPage, const SdPage* pNewPage )
     }
 }
 
+void SdCustomShow::RemovePage( const SdPage* pPage )
+{
+    maPages.erase(::std::remove(maPages.begin(), maPages.end(), pPage), maPages.end());
+}
+
 void   SdCustomShow::SetName(const String& rName)
 {
     aName = rName;
diff --git a/sd/source/core/drawdoc_animations.cxx b/sd/source/core/drawdoc_animations.cxx
index de62ec5..375dd4d 100644
--- a/sd/source/core/drawdoc_animations.cxx
+++ b/sd/source/core/drawdoc_animations.cxx
@@ -43,11 +43,7 @@ void SdDrawDocument::ReplacePageInCustomShows( const SdPage* pOldPage, const SdP
         for (sal_uLong i = 0; i < mpCustomShowList->Count(); i++)
         {
             SdCustomShow* pCustomShow = (SdCustomShow*) mpCustomShowList->GetObject(i);
-            if( pNewPage == 0 )
-                ::std::remove(pCustomShow->PagesVector().begin(), pCustomShow->PagesVector().end(),
-                    pOldPage);
-            else
-                pCustomShow->ReplacePage(pOldPage,pNewPage);
+            pCustomShow->ReplacePage(pOldPage, pNewPage);
         }
     }
 }
diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
index e0aa857..e44f61e 100644
--- a/sd/source/ui/unoidl/unocpres.cxx
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -144,10 +144,16 @@ void SAL_CALL SdXCustomPresentation::removeByIndex( sal_Int32 Index )
 
         if( xPage.is() )
         {
-            SvxDrawPage* pPage = SvxDrawPage::getImplementation(  xPage );
+            SvxDrawPage* pPage = SvxDrawPage::getImplementation( xPage );
             if(pPage)
-                ::std::remove(mpSdCustomShow->PagesVector().begin(), mpSdCustomShow->PagesVector().end(),
+            {
+                SdCustomShow::PageVec::iterator it = std::find(
+                    mpSdCustomShow->PagesVector().begin(),
+                    mpSdCustomShow->PagesVector().end(),
                     pPage->GetSdrPage());
+                if (it != mpSdCustomShow->PagesVector().end())
+                    mpSdCustomShow->PagesVector().erase(it);
+            }
         }
     }
 


More information about the Libreoffice-commits mailing list