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::uno::Sequence<com::sun:🫘: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 <vmiklos@collabora.com>
Tested-by: Jenkins
This commit is contained in:
Miklos Vajna
2024-11-26 09:14:02 +01:00
parent 0e334b25b9
commit 7cfcfa30aa

View File

@@ -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);