sfx2/source/view/viewfrm.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
New commits: commit e70d40d9af9e013be262fc562b272ec40f4d74ba Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Thu Jan 23 17:00:07 2025 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Thu Jan 23 18:16:00 2025 +0100 cool#11002 sfx2: fix crash in SfxViewFrame::StateReload_Impl() Now that the scheduler no longer calls std::abort(), we crashed with: #5 <signal handler called> (gdb) #6 std::__uniq_ptr_impl<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::_M_ptr (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:191 191 pointer _M_ptr() const noexcept { return std::get<0>(_M_t); } (gdb) #7 0x00007ff37cdaf9da in std::unique_ptr<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::get (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:462 462 { return _M_t._M_ptr(); } (gdb) #8 0x00007ff37cdab888 in std::unique_ptr<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::operator-> (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:455 455 return get(); (gdb) #9 0x00007ff37cd989e3 in SfxMedium::GetItemSet (this=0x0) at sfx2/source/doc/docfile.cxx:3810 3810 if (!pImpl->m_pSet) (gdb) up #10 0x00007ff37d082c50 in SfxViewFrame::StateReload_Impl (this=0x1ba830c0, rSet=SfxItemSet of pool 0x18ba4d60 with parent 0x0 and Which ranges: [(6312, 6312)] = {...}) at sfx2/source/view/viewfrm.cxx:944 944 const SfxBoolItem* pItem = pSh->GetMedium()->GetItemSet().GetItem(SID_EDITDOC, false); (gdb) print pSh->GetMedium() $1 = (SfxMedium *) 0x0 So just check for that case when the shell doesn't have a medium. Change-Id: I0198121853d283253b782c7e526ef8ef9436eed7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180664 Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com> Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index 8df6100e89b4..42a2e7368a24 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -941,7 +941,8 @@ void SfxViewFrame::StateReload_Impl( SfxItemSet& rSet ) rSet.DisableItem( nWhich ); else { - const SfxBoolItem* pItem = pSh->GetMedium()->GetItemSet().GetItem(SID_EDITDOC, false); + SfxMedium* pMedium = pSh->GetMedium(); + const SfxBoolItem* pItem = pMedium ? pMedium->GetItemSet().GetItem(SID_EDITDOC, false) : nullptr; if ( pItem && !pItem->GetValue() ) rSet.DisableItem( nWhich ); else