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

New commits:
commit 84079e1b0319519736c9bc6dfe02474509d51add
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: Tue Jul 25 10:15:57 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/+/154429
    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 07216640f354..e7080207760d 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1917,6 +1917,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