[Libreoffice-commits] .: sw/source

Cédric Bosdonnat cbosdo at kemper.freedesktop.org
Fri Mar 23 02:39:26 PDT 2012


 sw/source/core/layout/paintfrm.cxx |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

New commits:
commit 1a412714031bf6cf3f7962b044b2edea74899b46
Author: Cédric Bosdonnat <cedric.bosdonnat.ooo at free.fr>
Date:   Fri Mar 23 10:38:40 2012 +0100

    fixed crash due to use of STL deque for SwLineRects

diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index ad0e241..aa0438b 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -945,13 +945,16 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
         SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pOut );
 
         // Remove all help line that are almost covered (tables)
-        for (SwSubsRects::iterator it = this->begin(); it != this->end(); ++it)
+        SwSubsRects::iterator it = this->begin();
+        while ( it != this->end() )
         {
             SwLineRect &rLi = *it;
             const bool bVerticalSubs = rLi.Height() > rLi.Width();
 
-            for (SwSubsRects::iterator itK = it; itK != this->end(); ++itK)
+            SwSubsRects::iterator itK = it;
+            while ( itK != this->end() )
             {
+                bool bRemoved = false;
                 SwLineRect &rLk = (*itK);
                 if ( rLi.SSize() == rLk.SSize() )
                 {
@@ -969,6 +972,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
                                 // don't continue with inner loop any more:
                                 // the array may shrink!
                                 itK = this->end();
+                                bRemoved = true;
                             }
                         }
                         else
@@ -983,11 +987,17 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
                                 // don't continue with inner loop any more:
                                 // the array may shrink!
                                 itK = this->end();
+                                bRemoved = true;
                             }
                         }
                     }
                 }
+
+                if ( !bRemoved )
+                    ++itK;
             }
+
+            ++it;
         }
 
         if ( pRects && (!pRects->empty()) )
@@ -1008,7 +1018,7 @@ void SwSubsRects::PaintSubsidiary( OutputDevice *pOut,
                 pOut->SetDrawMode( 0 );
             }
 
-            for (SwSubsRects::iterator it = this->begin(); it != this->end(); ++it)
+            for (it = this->begin(); it != this->end(); ++it)
             {
                 SwLineRect &rLRect = (*it);
                 // Add condition <!rLRect.IsLocked()> to prevent paint of locked subsidiary lines.


More information about the Libreoffice-commits mailing list