sw/source/core/doc/docnew.cxx |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

New commits:
commit b22f665e2337ab019ec727f6d4a4d4c3e7b9453b
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Thu Nov 4 19:27:19 2021 +0100
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Fri Nov 5 17:48:03 2021 +0100

    sw: ~SwDoc: delete TOXTypes after TOXMarks
    
    warn:sw.core:24584:24584:sw/source/core/attr/calbck.cxx:156: lost a client 
of type: 9SwTOXMark at 0x57728d0 still registered on type: 8SwModify at 
0x55a9c70.
    soffice.bin: sw/source/core/attr/calbck.cxx:159: virtual 
SwModify::~SwModify(): Assertion `!hasListenersOnDeath' failed.
    
    Change-Id: I118426e802e7f7346e579b807a4d8c85252ffeb3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124757
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx
index c0a03a5b4c18..a59e1687ad67 100644
--- a/sw/source/core/doc/docnew.cxx
+++ b/sw/source/core/doc/docnew.cxx
@@ -470,11 +470,6 @@ SwDoc::~SwDoc()
         delete pTmp;
     }
 
-    for(const auto& pType : *mpTOXTypes)
-        pType->CallSwClientNotify(sw::DocumentDyingHint());
-    mpTOXTypes->clear();
-    mpDefTOXBases.reset();
-
     // Any of the FrameFormats can still have indices registered.
     // These need to be destroyed now at the latest.
     for( SwFrameFormat* pFormat : *mpFrameFormatTable )
@@ -498,6 +493,14 @@ SwDoc::~SwDoc()
     m_pNodes->DelNodes( SwNodeIndex(*m_pNodes), m_pNodes->Count() );
     rUndoNodes.DelNodes( SwNodeIndex( rUndoNodes ), rUndoNodes.Count() );
 
+    // clear TOX after nodes - TOXMarks are gone now so SwTOXType has no 
clients
+    for (const auto& pType : *mpTOXTypes)
+    {
+        pType->CallSwClientNotify(sw::DocumentDyingHint());
+    }
+    mpTOXTypes->clear();
+    mpDefTOXBases.reset();
+
     // Delete Formats, make it permanent some time in the future
 
     // Delete for Collections

Reply via email to