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

New commits:
commit d60f4042bdc1dac465d38fcfae85b34630759be3
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Jul 14 14:44:59 2023 +0200
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Jul 24 22:53: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)
    
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154440
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit 4270552395600487f9d680cfdc9cd0ad6f457497)
    
    cid#1538889 Pointer to local outside scope
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154767
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    (cherry picked from commit b6f3b76fb611a5f2c7f32296bc86316b6abb32cb)
    
    Change-Id: Ib24c788a49a6fee364b44a1dbc8d53870c074596
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154450
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

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

Reply via email to