sfx2/source/view/lokhelper.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 7cfcfa30aa606536d7693ea09f39e57c60af00d6
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Tue Nov 26 09:14:02 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Tue Nov 26 16:22:22 2024 +0100

    sfx2 lok: fix crash in SfxLokHelper::notifyUpdate()
    
    Crashreport signature:
    
    > kit-09946-09946 2024-11-25 16:46:13.180120 +0000 [ kitbroker_498 ] SIG   
Fatal signal received: SIGSEGV code: 1 for address: 0x0
    > program/libmergedlo.so
    >       SfxLokHelper::notifyUpdate(SfxViewShell const*, int)
    >               sfx2/source/view/lokhelper.cxx:1072
    > program/libswlo.so
    >       SwViewShell::GetSfxViewShell() const
    >               sw/inc/viewsh.hxx:472
    > program/libswlo.so
    >       SwCursorShell::UpdateCursor(unsigned short, bool)
    >               sw/source/core/crsr/crsrsh.cxx:2382
    ...
    > program/libmergedlo.so
    >       framework::Desktop::loadComponentFromURL(rtl::OUString const&, 
rtl::OUString const&, int, 
com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&)
    >               framework/source/services/desktop.cxx:592
    
    I.e. it can happen that during load we don't yet have a view, handle
    this in SfxLokHelper::notifyUpdate() till it takes a pointer and not a
    reference.
    
    Change-Id: Ifa5d9300029076e91ba8722152a7d91a1f2ecbc0
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177343
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index 5bcb9ef22b98..ce3822502a36 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -1063,7 +1063,7 @@ void SfxLokHelper::getCommandValues(tools::JsonWriter& 
rJsonWriter, std::string_
 
 void SfxLokHelper::notifyUpdate(SfxViewShell const* pThisView, int nType)
 {
-    if (DisableCallbacks::disabled())
+    if (DisableCallbacks::disabled() || !pThisView)
         return;
 
     pThisView->libreOfficeKitViewUpdatedCallback(nType);

Reply via email to