From b22f665e2337ab019ec727f6d4a4d4c3e7b9453b Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 4 Nov 2021 19:27:19 +0100 Subject: 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 --- sw/source/core/doc/docnew.cxx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sw') 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 -- cgit