From 19f41fce02b83e9a076b5f97c22b5a8926fb6144 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 26 Sep 2017 21:40:13 +0200 Subject: sw: fix ~SwIndexReg assert in DelFullPara() importing tdf108272-1.docx The code in DelFullPara() returns early if it can't move the rPam out of the to-be-deleted paragraph, but it only checks that the point of the rPam is outside; it then rather pointlessly assigns the 0 index in the node where the mark is, which leaves the mark on the to-be-deleted paragraph. In this modern day and age, after much technological progress, DeleteMark() actually does unregister its SwIndex, so just do that. Change-Id: Ia1643cf0b976857809ee4130efdec37ce831fdef --- sw/source/core/doc/DocumentContentOperationsManager.cxx | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index ff1e4586d0df..4d72d883e8fe 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -1848,12 +1848,12 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) *rPam.GetPoint() = *aDelPam.GetPoint(); pUndo->SetPgBrkFlags( bSavePageBreak, bSavePageDesc ); m_rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo); + rPam.DeleteMark(); } else { SwNodeRange aRg( rStt.nNode, rEnd.nNode ); - if( rPam.GetPoint() != &rEnd ) - rPam.Exchange(); + rPam.Normalize(false); // Try to move past the End if( !rPam.Move( fnMoveForward, GoInNode ) ) @@ -1862,7 +1862,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) rPam.Exchange(); if( !rPam.Move( fnMoveBackward, GoInNode )) { - OSL_FAIL( "no more Nodes" ); + SAL_WARN("sw.core", "DelFullPara: no more Nodes"); return false; } } @@ -1895,13 +1895,9 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) } } - SwContentNode *pTmpNode = rPam.GetBound().nNode.GetNode().GetContentNode(); - rPam.GetBound().nContent.Assign( pTmpNode, 0 ); - pTmpNode = rPam.GetBound( false ).nNode.GetNode().GetContentNode(); - rPam.GetBound( false ).nContent.Assign( pTmpNode, 0 ); + rPam.DeleteMark(); m_rDoc.GetNodes().Delete( aRg.aStart, nNodeDiff+1 ); } - rPam.DeleteMark(); m_rDoc.getIDocumentState().SetModified(); return true; -- cgit