[Libreoffice-commits] .: Branch 'libreoffice-3-4' - sw/source

Michael Stahl mst at kemper.freedesktop.org
Fri Mar 9 08:06:47 PST 2012


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

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

    fdo#46337: don't use an invalidated iterator
    
    (cherry picked from commit 2df1c40b4b7cb3107a68984db644f10097f04c3c)
    
    Signed-off-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 5dfb281..a8d29cb 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -515,7 +515,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 )
@@ -526,10 +526,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