From 113df4d0fba25e7c8d5f08992da8dd687a6b4e6a Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 19 Nov 2024 08:44:12 +0100 Subject: desktop: fix crash in forceSetClipboardForCurrentView() Crashreport signature: > Fatal signal received: SIGSEGV code: 1 for address: 0x0 > program/libmergedlo.so > (anonymous namespace)::forceSetClipboardForCurrentView(_LibreOfficeKitDocument*) > desktop/source/lib/init.cxx:1376 (discriminator 6) > program/libmergedlo.so > rtl::Reference::~Reference() > include/rtl/ref.hxx:128 > program/libmergedlo.so > com::sun::star::uno::Reference::~Reference() > include/com/sun/star/uno/Reference.hxx:113 Sounds like an attempted document load that failed, but we still try to set the clipboard for the first view during shutdown. Change-Id: I21e5742ae4fcd4b24daf2888f3d64aae437d4fda Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176812 Tested-by: Jenkins Reviewed-by: Miklos Vajna (cherry picked from commit 6c6e4358ae14328e1dd4bab7cdd8e9019187429c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176832 Reviewed-by: Michael Stahl --- desktop/source/lib/init.cxx | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'desktop') diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 90cfba8e4e87..ece81f0351dc 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -1294,6 +1294,10 @@ rtl::Reference forceSetClipboardForCurrentView(LibreOfficeKitDocum { ITiledRenderable* pDoc = getTiledRenderable(pThis); rtl::Reference xClip(LOKClipboardFactory::getClipboardForCurView()); + if (!pDoc) + { + return xClip; + } SAL_INFO("lok", "Set to clipboard for view " << xClip.get()); // FIXME: using a hammer here - should not be necessary if all tests used createView. -- cgit