Question about iterator management in sw/source/core/fields/cellfml.cxx

julien2412 serval2412 at
Thu Feb 2 12:08:37 PST 2012

Would this patch better ? (I kept the for loop)
diff --git a/sw/source/core/fields/cellfml.cxx
index 33b953e..5c626dd 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -967,8 +967,8 @@ void SwTableFormula::GetBoxes( const SwTableBox&
                 if( pTbl->IsHeadline( *pLine ) )
-                    rBoxes.erase( it++ );
-                    --it;
+                    SwSelBoxes::iterator toErase = it;
+                    rBoxes.erase( toErase );
         } while( sal_False );

I read that to erase a position on a iterator invalidate this iterator from
position to the end
I don't know if to create this temporary variable "toErase" change something
or it's all the same.

Moreover, I don't know if the evolution of the standard had changed the
behavior on this point.

Any idea ?

(sorry for the nitpicking but I'd like to understand this point)

View this message in context:
Sent from the Dev mailing list archive at

More information about the LibreOffice mailing list