diff options
author | Michael Stahl <mstahl@redhat.com> | 2017-03-07 23:13:51 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-03-07 23:37:03 +0100 |
commit | cdfe5c28a31ee94a6b00fefd1b4a31aaf6333cf9 (patch) | |
tree | 4c8a7f32daa35212365e508c7680ecbbba324c4a /sw | |
parent | 9b3fa51e7ba4e2bfe9806295c3cbc8db347480d8 (diff) |
sw: SwUndoCompDoc: fix assertion about invalid node indexes
Try the steps from i#101009, then Undo and Redo:
Assertion `idx < m_nSize' failed
The problem is that the indexes stored in SwUndoCompDoc are for the
document *post* insertion of the content of the other document,
so delay the creation of rPam in SwUndoCompDoc::RedoImpl() until
the content is inserted.
Change-Id: I0d9c8dc90ea88c87bc56329b42a0ec22bbc6b248
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/undo/unredln.cxx | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/sw/source/core/undo/unredln.cxx b/sw/source/core/undo/unredln.cxx index 5e6a7c3f1599..690b424ce6ad 100644 --- a/sw/source/core/undo/unredln.cxx +++ b/sw/source/core/undo/unredln.cxx @@ -462,10 +462,10 @@ void SwUndoCompDoc::UndoImpl(::sw::UndoRedoContext & rContext) void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext) { SwDoc& rDoc = rContext.GetDoc(); - SwPaM& rPam(AddUndoRedoPaM(rContext)); if( bInsert ) { + SwPaM& rPam(AddUndoRedoPaM(rContext)); if( pRedlData && IDocumentRedlineAccess::IsRedlineOn( GetRedlineFlags() )) { SwRangeRedline* pTmp = new SwRangeRedline(*pRedlData, rPam); @@ -474,7 +474,10 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext) } else if( !( RedlineFlags::Ignore & GetRedlineFlags() ) && !rDoc.getIDocumentRedlineAccess().GetRedlineTable().empty() ) + { rDoc.getIDocumentRedlineAccess().SplitRedline(rPam); + } + SetPaM(rPam, true); } else { @@ -488,14 +491,15 @@ void SwUndoCompDoc::RedoImpl(::sw::UndoRedoContext & rContext) delete pUnDel; pUnDel = nullptr; - SetPaM(rPam); + // note: don't call SetPaM before executing Undo of members + SwPaM& rPam(AddUndoRedoPaM(rContext)); SwRangeRedline* pTmp = new SwRangeRedline(*pRedlData, rPam); static_cast<SwRedlineTable&>(rDoc.getIDocumentRedlineAccess().GetRedlineTable()).Insert( pTmp ); pTmp->InvalidateRange(); - } - SetPaM(rPam, true); + SetPaM(rPam, true); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |