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

New commits:
commit 01d66be56971875a690f3e698093492e39485efa
Author:     Miklos Vajna <[email protected]>
AuthorDate: Thu Jan 29 09:54:57 2026 +0100
Commit:     Miklos Vajna <[email protected]>
CommitDate: Thu Jan 29 15:46:38 2026 +0100

    sfx2: fix crash in SfxObjectShell::PostActivateEvent_Impl()
    
    gdb backtrace on the core file from the crashreport:
    
            #0  0x00007078323c6c4e in std::__shared_ptr<SfxItemSet, 
(__gnu_cxx::_Lock_policy)2>::operator bool (this=<optimized out>)
                at 
/opt/rh/devtoolset-12/root/usr/include/c++/12/bits/shared_ptr_base.h:1670
            #1  SfxMedium::GetItemSet (this=0x0) at 
sfx2/source/doc/docfile.cxx:3840
            #2  0x0000707832428792 in SfxObjectShell::PostActivateEvent_Impl 
(this=0x3e357de0, pFrame=pFrame@entry=0x427b7460)
                at sfx2/source/doc/objmisc.cxx:933
            #3  0x0000707832214661 in SfxApplication::SetViewFrame_Impl 
(this=0x3c0a39d0, pFrame=pFrame@entry=0x427b7460)
                at sfx2/source/appl/app.cxx:273
            #4  0x000070783254804f in SfxViewFrame::SetViewFrame 
(pFrame=0x427b7460) at sfx2/source/view/viewfrm.cxx:3735
    
    and:
    
            #2  0x0000707832428792 in SfxObjectShell::PostActivateEvent_Impl 
(this=0x3e357de0, pFrame=pFrame@entry=0x427b7460)
                at sfx2/source/doc/objmisc.cxx:933
            933         const SfxBoolItem* pHiddenItem = 
pMedium->GetItemSet().GetItem(SID_HIDDEN, false);
            (gdb) print pMedium
            $1 = (SfxMedium *) 0x0
    
    Assume that no medium means the same as medium having no hiddem item.
    
    Change-Id: I6295cfd90d2a3d529fa5e915983578e6768a2244
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198357
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins

diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 2c4a8a9b646e..405b312305e2 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -931,7 +931,7 @@ void SfxObjectShell::PostActivateEvent_Impl( SfxViewFrame 
const * pFrame )
     if ( pSfxApp->IsDowning() || IsLoading() || !pFrame || 
pFrame->GetFrame().IsClosing_Impl() )
         return;
 
-    const SfxBoolItem* pHiddenItem = pMedium->GetItemSet().GetItem(SID_HIDDEN, 
false);
+    const SfxBoolItem* pHiddenItem = pMedium ? 
pMedium->GetItemSet().GetItem(SID_HIDDEN, false) : nullptr;
     if ( !pHiddenItem || !pHiddenItem->GetValue() )
     {
         SfxEventHintId nId = pImpl->nEventId;

Reply via email to