[Libreoffice-commits] .: sw/source

Lubos Lunak llunak at kemper.freedesktop.org
Mon Jan 9 06:53:45 PST 2012


 sw/source/filter/ww8/docxattributeoutput.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 2df1c40b4b7cb3107a68984db644f10097f04c3c
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Mon Jan 9 15:51:10 2012 +0100

    don't use an invalidated iterator

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b23bcc0..df37cf0 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -518,7 +518,7 @@ void DocxAttributeOutput::StartRun( const SwRedlineData* pRedlineData )
 void DocxAttributeOutput::EndRun()
 {
     // Write field starts
-    for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); ++pIt )
+    for ( std::vector<FieldInfos>::iterator pIt = m_Fields.begin(); pIt != m_Fields.end(); )
     {
         // Add the fields starts for all but hyperlinks and TOCs
         if ( pIt->bOpen && pIt->pField )
@@ -529,10 +529,11 @@ void DocxAttributeOutput::EndRun()
             // Unknown fields sould be removed too
             if ( !pIt->bClose || ( pIt->eType == ww::eUNKNOWN ) )
             {
-                m_Fields.erase( pIt );
-                --pIt;
+                pIt = m_Fields.erase( pIt );
+                continue;
             }
         }
+        ++pIt;
     }
 
     // write the run properties + the text, already in the correct order


More information about the Libreoffice-commits mailing list