diff options
author | Miklos Vajna <vmiklos@collabora.com> | 2021-03-18 20:59:36 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-03-07 12:57:42 +0100 |
commit | fa7cdf1777aa063d3b1cf89a75a66e2ed319c4a9 (patch) | |
tree | 7949cf10053340a5a7eeb514182ab08cc1104422 | |
parent | 126dd55667826f5d1268a570f7e2930b1b78fc43 (diff) |
Related: tdf#133933 sw: fix assertion failure in the SwIndexReg dtor
Make sure that by the time we delete a text node, no SwIndexes point to
us.
Change-Id: I9248a2ebe529e5a0aab0e37bf676e669b9bddb1d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112698
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
(cherry picked from commit e782937228479054336b564a4c34697a12530469)
-rw-r--r-- | sw/source/core/inc/UndoTable.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/undo/untbl.cxx | 8 |
2 files changed, 7 insertions, 3 deletions
diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx index 2b51dbdbb111..8815cb0881c7 100644 --- a/sw/source/core/inc/UndoTable.hxx +++ b/sw/source/core/inc/UndoTable.hxx @@ -280,7 +280,7 @@ class SwUndoTableCpyTable : public SwUndo //b6341295: When redlining is active, PrepareRedline has to create the //redlining attributes for the new and the old table cell content static std::unique_ptr<SwUndo> PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, - const SwPosition& rPos, bool& rJoin, bool bRedo ); + SwPosition& rPos, bool& rJoin, bool bRedo ); public: SwUndoTableCpyTable(const SwDoc* pDoc); diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index 14cc8de03a84..a07d951dc288 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -2517,7 +2517,7 @@ void SwUndoTableCpyTable::RedoImpl(::sw::UndoRedoContext & rContext) // Otherwise aInsIdx has been moved during the Undo operation if( pEntry->bJoin ) { - SwPaM const& rLastPam = + SwPaM& rLastPam = rContext.GetCursorSupplier().GetCurrentShellCursor(); pUndo = PrepareRedline( &rDoc, rBox, *rLastPam.GetPoint(), pEntry->bJoin, true ); @@ -2632,7 +2632,7 @@ void SwUndoTableCpyTable::AddBoxAfter( const SwTableBox& rBox, const SwNodeIndex // rJoin is true if Redo() is calling and the content has already been merged std::unique_ptr<SwUndo> SwUndoTableCpyTable::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox, - const SwPosition& rPos, bool& rJoin, bool bRedo ) + SwPosition& rPos, bool& rJoin, bool bRedo ) { std::unique_ptr<SwUndo> pUndo; // b62341295: Redline for copying tables @@ -2656,6 +2656,10 @@ std::unique_ptr<SwUndo> SwUndoTableCpyTable::PrepareRedline( SwDoc* pDoc, const if( !bRedo && rPos.nNode.GetNode().GetTextNode() ) { // Try to merge, if not called by Redo() rJoin = true; + + // Park this somewhere else so nothing points to the to-be-deleted node. + rPos.nContent.Assign(pText, 0); + pText->JoinNext(); } } |