sw/inc/doc.hxx | 2 ++ sw/source/core/bastyp/init.cxx | 1 + sw/source/core/doc/docnew.cxx | 4 ++++ 3 files changed, 7 insertions(+)
New commits: commit ab61be6ed502349152b165bc3db4c61f04c2f20d Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Mar 9 08:01:34 2023 +0100 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Thu Mar 9 09:54:03 2023 +0000 sw doc model dump: allow invoking this from outside sw/ in a debugger There is only a single SwDoc instance in many cases, having an easy to access pointer to that is helpful when the backtrace doesn't include a frame in sw/ code. This allows something like 'print SwDoc::s_pLast->dumpAsXml(0)' in gdb, even if e.g. the current frame is xmloff/, without hunting for a parent that is in sw/. Change-Id: Id70baf7919ef6fde7b834704741dab70531e7e2d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/148522 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index dd2973fb7447..17d130a51be4 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -337,6 +337,8 @@ private: bool mbContainsAtPageObjWithContentAnchor : 1; static SwAutoCompleteWord *s_pAutoCompleteWords; //< List of all words for AutoComplete + /// The last, still alive SwDoc instance, for debugging. + static SwDoc* s_pLast; // private methods SwFlyFrameFormat* MakeFlySection_( const SwPosition& rAnchPos, diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 52e452bb4aa0..a5bcd736966e 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -440,6 +440,7 @@ SfxItemInfo aSlotTab[] = std::vector<SvGlobalName> *pGlobalOLEExcludeList = nullptr; SwAutoCompleteWord* SwDoc::s_pAutoCompleteWords = nullptr; +SwDoc* SwDoc::s_pLast = nullptr; SwCheckIt* pCheckIt = nullptr; static CharClass* pAppCharClass = nullptr; diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 716c31f0dbae..0a5aedf6a105 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -389,6 +389,8 @@ SwDoc::SwDoc() } getIDocumentState().ResetModified(); + + s_pLast = this; } /** @@ -398,6 +400,8 @@ SwDoc::SwDoc() */ SwDoc::~SwDoc() { + s_pLast = nullptr; + mxVbaFind.clear(); // nothing here should create Undo actions!