sw/source/uibase/uno/unotxdoc.cxx | 5 +++++ 1 file changed, 5 insertions(+)
New commits: commit 66f75dbf7dd98681e1be030790a4dc5fe809fecc Author: Miklos Vajna <[email protected]> AuthorDate: Tue Jan 6 09:30:58 2026 +0100 Commit: Caolán McNamara <[email protected]> CommitDate: Fri Jan 9 12:18:37 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/+/196595 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 553188bbefa8..4ce2e4d87a3b 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3327,6 +3327,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,
