sw/source/core/docnode/nodes.cxx                    |    3 +++
 sw/source/core/txtnode/OnlineAccessibilityCheck.cxx |    7 +++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

New commits:
commit d19fb1dd668473f2d4f8dbde8bac1fcb34042a6a
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Fri Sep 15 17:52:29 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Mon Sep 18 17:24:06 2023 +0200

    sw: fix crash when moving nodes into undo array
    
    In SwUndoSaveContent::MoveToUndoNds() a node is split and in
    sw::OnlineAccessibilityCheck::runAccessibilityCheck() we get:
    
    sw/inc/ndindex.hxx:99: bool SwNodeIndex::operator<(const SwNode&) const: 
Assertion `&GetNodes() == &rNd.GetNodes()' failed.
    
    Try to make sure that OnlineAccessibilityCheck doesn't touch nodes in
    the undo array.
    
    Change-Id: Iaeb0d36c341c05948cdfcce08009b0430a78f214
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156970
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index e5d20e4691ff..9f9c516e8f3b 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -346,6 +346,9 @@ void SwNodes::ChgNode( SwNodeIndex const & rDelPos, 
SwNodeOffset nSz,
                     if( pCNd->IsNoTextNode() && bRestPersData )
                         
static_cast<SwNoTextNode*>(pCNd)->RestorePersistentData();
                 }
+
+                // reset Accessibility issue state
+                pCNd->resetAndQueueAccessibilityCheck();
             }
         }
     }
diff --git a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx 
b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
index 27d4d5d56f12..d85379ffb1ee 100644
--- a/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
+++ b/sw/source/core/txtnode/OnlineAccessibilityCheck.cxx
@@ -306,8 +306,11 @@ void OnlineAccessibilityCheck::resetAndQueue(SwNode* 
pNode, bool bIssueObjectNam
 
     pNode->getAccessibilityCheckStatus().reset();
     m_aNodes.erase(pNode);
-    runAccessibilityCheck(pNode);
-    updateNodeStatus(pNode, bIssueObjectNameChanged);
+    if (&pNode->GetNodes() == &m_rDocument.GetNodes()) // don't add undo array
+    {
+        runAccessibilityCheck(pNode);
+        updateNodeStatus(pNode, bIssueObjectNameChanged);
+    }
     updateStatusbar();
 }
 

Reply via email to