diff options
author | David Tardon <dtardon@redhat.com> | 2012-09-07 10:00:44 +0200 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-09-07 13:43:37 +0100 |
commit | 032b29619484a2a4ade0600cd978df86d5d522a5 (patch) | |
tree | b40dc4452022aebd11ee1d28133a85526f79996f /sw/source/core | |
parent | a251a353300e27625741338b6290a109c5588952 (diff) |
fdo#54620 do not use vector iterator after insert
Change-Id: I5e809f38a500ab818e9acef80b419dfece7a29fa
(cherry picked from commit 06ae26b5676c29c4d1cc9c65f5bbaede9483a21d)
Signed-off-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw/source/core')
-rw-r--r-- | sw/source/core/doc/gctable.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index 5507c54a36cb..f71cb2af1c44 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 } |