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

New commits:
commit 9f25e61d0e9bbd762ef6da063c16c65e53c9c980
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Fri Nov 29 08:52:11 2024 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Fri Nov 29 13:36:06 2024 +0100

    sfx2 lok: fix crash in SfxLokHelper::notifyOtherViewsUpdatePerViewId()
    
    Crashreport signature:
    
    > SIG   Fatal signal received: SIGSEGV code: 1 for address: 0x0
    > program/libmergedlo.so
    >       SfxLokHelper::notifyOtherViewsUpdatePerViewId(SfxViewShell const*, 
int)
    >               sfx2/source/view/lokhelper.cxx:1098
    > program/libswlo.so
    >       SwSelPaintRects::Show(std::vector<rtl::OString, 
std::allocator<rtl::OString> >*)
    >               sw/source/core/crsr/viscrs.cxx:514
    ...
    > program/libswlo.so
    >       SwWrtShell::SwWrtShell(SwDoc&, vcl::Window*, SwView&, SwViewOption 
const*)
    >               sw/source/uibase/wrtsh/wrtsh1.cxx:2032
    ...
    > 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, similar to
    commit a2b22f5b551cb2030cd29d3dd3510fca42a0bfc1 (sfx2 lok: fix crash in
    SfxLokHelper::notifyUpdate(), 2024-11-26).
    
    Change-Id: Id17a61296a181a2ba4909b633d46a3c9d7aacb02
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177525
    Tested-by: Jenkins
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>

diff --git a/sfx2/source/view/lokhelper.cxx b/sfx2/source/view/lokhelper.cxx
index ce3822502a36..19891df77ce4 100644
--- a/sfx2/source/view/lokhelper.cxx
+++ b/sfx2/source/view/lokhelper.cxx
@@ -1087,8 +1087,7 @@ void SfxLokHelper::notifyUpdatePerViewId(SfxViewShell 
const* pTargetShell, SfxVi
 
 void SfxLokHelper::notifyOtherViewsUpdatePerViewId(SfxViewShell const* 
pThisView, int nType)
 {
-    assert(pThisView != nullptr && "pThisView must be valid");
-    if (DisableCallbacks::disabled())
+    if (DisableCallbacks::disabled() || !pThisView)
         return;
 
     int viewId = SfxLokHelper::getView(pThisView);

Reply via email to