[Libreoffice-commits] .: Branch 'libreoffice-3-6' - sw/source
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Fri Sep 7 05:44:01 PDT 2012
sw/source/core/doc/gctable.cxx | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
New commits:
commit 032b29619484a2a4ade0600cd978df86d5d522a5
Author: David Tardon <dtardon at redhat.com>
Date: Fri Sep 7 10:00:44 2012 +0200
fdo#54620 do not use vector iterator after insert
Change-Id: I5e809f38a500ab818e9acef80b419dfece7a29fa
(cherry picked from commit 06ae26b5676c29c4d1cc9c65f5bbaede9483a21d)
Signed-off-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
index 5507c54..f71cb2a 100644
--- a/sw/source/core/doc/gctable.cxx
+++ b/sw/source/core/doc/gctable.cxx
@@ -357,19 +357,20 @@ static bool lcl_MergeGCBox(SwTableBox* pTblBox, void*const pPara)
if( 1 == pTblBox->GetTabLines().Count() )
{
- // Box with a Line, then move all the Line's Boxes after this Box
- // into the parent Line and delete this Box
+ // we have a box with a single line, so we just replace it by the line's boxes
SwTableLine* pInsLine = pTblBox->GetUpper();
SwTableLine* pCpyLine = pTblBox->GetTabLines()[0];
SwTableBoxes::iterator it = std::find( pInsLine->GetTabBoxes().begin(), pInsLine->GetTabBoxes().end(), pTblBox );
for( n = 0; n < pCpyLine->GetTabBoxes().size(); ++n )
pCpyLine->GetTabBoxes()[n]->SetUpper( pInsLine );
- pInsLine->GetTabBoxes().insert( it + 1, pCpyLine->GetTabBoxes().begin(), pCpyLine->GetTabBoxes().end());
+ // remove the old box from its parent line
+ it = pInsLine->GetTabBoxes().erase( it );
+ // insert the nested line's boxes in its place
+ pInsLine->GetTabBoxes().insert( it, pCpyLine->GetTabBoxes().begin(), pCpyLine->GetTabBoxes().end());
pCpyLine->GetTabBoxes().clear();
- // Delete the old Box with the Line
- delete *it;
- pInsLine->GetTabBoxes().erase( it );
+ // destroy the removed box
+ delete pTblBox;
return false; // set up anew
}
More information about the Libreoffice-commits
mailing list