sw/source/uibase/uno/unotxdoc.cxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 2771d029ccc9794e748a930bfcb2ff7ca6b132c1 Author: Miklos Vajna <[email protected]> AuthorDate: Tue Jan 6 09:30:58 2026 +0100 Commit: Miklos Vajna <[email protected]> CommitDate: Mon Jan 12 12:05:58 2026 +0100 sw: fix crash in SwXTextDocument::getDocumentSize() gdb on the crashreport core dump: Program terminated with signal SIGSEGV, Segmentation fault. #0 SwViewShell::GetLayout (this=0x0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/shared_ptr_base.h:1665 and #0 SwViewShell::GetLayout (this=0x0) at /opt/rh/devtoolset-12/root/usr/include/c++/12/bits/shared_ptr_base.h:1665 #1 0x000078c9268a799d in SwViewShell::GetDocSize (this=<optimized out>) at sw/source/core/view/viewsh.cxx:2320 #2 0x000078c926ca55e8 in non-virtual thunk to SwXTextDocument::getDocumentSize() () at sw/inc/unotxdoc.hxx:444 #3 0x000078c933bc4e16 in doc_getDocumentSize (pThis=0x8e8cc20, pWidth=0x7ffdd9b4c5e0, pHeight=0x7ffdd9b4c5e8) at desktop/source/lib/init.cxx:4626 Fix it similar to what SwXTextDocument::setPart() does: don't assume that we still have a view shell by the time getDocumentSize() is called, a document teardown may be in progress where we still have a model, but no views anymore. Change-Id: Id2f5ac4bf08601a9664909f5a78322bf41998a86 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/197062 Reviewed-by: Miklos Vajna <[email protected]> Tested-by: Jenkins diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 95deb0aa9efc..7b3a48752c8a 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3381,6 +3381,11 @@ void SwXTextDocument::paintTile( VirtualDevice &rDevice, Size SwXTextDocument::getDocumentSize() { SwViewShell* pViewShell = m_pDocShell->GetWrtShell(); + if (!pViewShell) + { + return Size(); + } + Size aDocSize = pViewShell->GetDocSize(); return Size(aDocSize.Width() + 2 * DOCUMENTBORDER,
