desktop/source/lib/init.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 6c6e4358ae14328e1dd4bab7cdd8e9019187429c
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Nov 19 08:44:12 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Wed Nov 20 10:21:46 2024 +0100

    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<LOKClipboard>::~Reference()
    >               include/rtl/ref.hxx:128
    > program/libmergedlo.so
    >       
com::sun::star::uno::Reference<com::sun::star::lang::XComponent>::~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 <vmik...@collabora.com>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 7de039d56e58..006910049f7d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -1357,6 +1357,10 @@ rtl::Reference<LOKClipboard> 
forceSetClipboardForCurrentView(LibreOfficeKitDocum
 {
     ITiledRenderable* pDoc = getTiledRenderable(pThis);
     rtl::Reference<LOKClipboard> 
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.

Reply via email to