[Libreoffice-commits] core.git: sw/source

Miklos Vajna (via logerrit) logerrit at kemper.freedesktop.org
Fri Mar 19 07:08:49 UTC 2021


 sw/source/core/inc/UndoTable.hxx |    2 +-
 sw/source/core/undo/untbl.cxx    |    8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

New commits:
commit e782937228479054336b564a4c34697a12530469
Author:     Miklos Vajna <vmiklos at collabora.com>
AuthorDate: Thu Mar 18 20:59:36 2021 +0100
Commit:     Miklos Vajna <vmiklos at collabora.com>
CommitDate: Fri Mar 19 08:08:14 2021 +0100

    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 at collabora.com>

diff --git a/sw/source/core/inc/UndoTable.hxx b/sw/source/core/inc/UndoTable.hxx
index 15bb1dc85bea..472f9fdd65d5 100644
--- a/sw/source/core/inc/UndoTable.hxx
+++ b/sw/source/core/inc/UndoTable.hxx
@@ -273,7 +273,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& rDoc);
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index b15a8db09331..fdc8b25b0631 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -2493,7 +2493,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 );
@@ -2608,7 +2608,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
@@ -2632,6 +2632,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();
             }
         }


More information about the Libreoffice-commits mailing list