sw/source/core/docnode/ndtbl.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit 4270552395600487f9d680cfdc9cd0ad6f457497
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jul 14 14:44:59 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Jul 14 20:27:11 2023 +0200

    tdf#156267 sw: remove DdeBookmarks in SwDoc::DelTable()
    
    On Copy, a SwTransferDdeLink is created, which also creates a
    DDE_BOOKMARK (it's the only thing that does that) without Undo.
    
    On Delete, the DelTable() creates SwUndoDelete which creates a
    SwHistoryBookmark; then the DeleteAndJoin() deletes the DdeBookmark.
    
    On Undo, the SwHistoryBookmark doesn't find its bookmark, and crashes.
    
    Because the DdeBookmark is artificial and deliberately created without
    Undo, DelTable() should prevent the SwHistoryBookmark by deleting it
    first.
    
    (regression from commit d81379db730a163c5ff75d4f3a3cddbd7b5eddda)
    
    Change-Id: Ib24c788a49a6fee364b44a1dbc8d53870c074596
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154440
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 08775066cb91..cd6358ea0ecf 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1917,6 +1917,11 @@ void SwDoc::DeleteCol( const SwCursor& rCursor )
 
 void SwDoc::DelTable(SwTableNode *const pTableNd)
 {
+    {
+        // tdf#156267 remove DdeBookmarks before deleting nodes
+        SwDataChanged aTmp(SwPaM(*pTableNd, *pTableNd->EndOfSectionNode()));
+    }
+
     bool bNewTextNd = false;
     // Is it alone in a FlyFrame?
     SwNodeIndex aIdx( *pTableNd, -1 );

Reply via email to