comphelper/source/misc/lok.cxx | 3 ++- sfx2/source/doc/objcont.cxx | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-)
New commits: commit 3974af7dca82f887dfdfe88f087583508c19e7ab Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Fri Aug 16 11:24:27 2024 +0200 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Fri Aug 16 18:31:27 2024 +0200 sfx2: fix crash in SfxObjectShell::IsHelpDocument() Seen while running the online.git unit-quarantine testcase: #0 std::__uniq_ptr_impl<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::_M_ptr() const (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:191 #1 0x00007f2f25fa398a in std::unique_ptr<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::get() const (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:462 #2 0x00007f2f25f9fae2 in std::unique_ptr<SfxMedium_Impl, std::default_delete<SfxMedium_Impl> >::operator->() const (this=0x10) at /usr/include/c++/12/bits/unique_ptr.h:455 #3 0x00007f2f25f8bbd2 in SfxMedium::GetFilter() const (this=0x0) at sfx2/source/doc/docfile.cxx:3272 #4 0x00007f2f260067ce in SfxObjectShell::IsHelpDocument() const (this=0x5c6adc0) at sfx2/source/doc/objcont.cxx:589 #5 0x00007f2f0f6991c1 in SwLayIdle::isJobEnabled(IdleJobType, SwViewShell const*) (eJob=IdleJobType::SMART_TAGS, pViewShell=0x5a573f0) at sw/source/core/layout/layact.cxx:2218 #6 0x00007f2f0f69926d in SwLayIdle::DoIdleJob(IdleJobType, IdleJobArea) (this=0x7ffc9daf4180, eJob=IdleJobType::SMART_TAGS, eJobArea=IdleJobArea::VISIBLE) at sw/source/core/layout/layact.cxx:2234 #7 0x00007f2f0f699d81 in SwLayIdle::SwLayIdle(SwRootFrame*, SwViewShellImp*) (this=0x7ffc9daf4180, pRt=0x5a8fad0, pI=0x5a58860) at sw/source/core/layout/layact.cxx:2355 #8 0x00007f2f0fdccf21 in SwViewShell::LayoutIdle() (this=0x5a573f0) at sw/source/core/view/viewsh.cxx:826 Assume that in case the object shell has no underlying medium, then that's not a help document. Also fix the higher level problem that the LOK AnyInput callback should not be invoked while doing a LOK background save, as the object shell in the forked process has no underlying medium. That fixes the failure seen while running the online.git unit-save-torture test. Change-Id: Idcdd62cc177ac4b7edfbcef8906da2e42610ee98 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171950 Tested-by: Jenkins Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/comphelper/source/misc/lok.cxx b/comphelper/source/misc/lok.cxx index 07de005ad281..88521ebb455e 100644 --- a/comphelper/source/misc/lok.cxx +++ b/comphelper/source/misc/lok.cxx @@ -328,7 +328,8 @@ bool anyInput() { bool bRet = false; - if (g_pAnyInputCallback && g_pAnyInputCallbackData) + // Ignore input events during background save. + if (!g_bForkedChild && g_pAnyInputCallback && g_pAnyInputCallbackData) { bRet = g_pAnyInputCallback(g_pAnyInputCallbackData); } diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index ba4864fa9a7b..1507ad6f810d 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -587,7 +587,12 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) bool SfxObjectShell::IsHelpDocument() const { - std::shared_ptr<const SfxFilter> pFilter = GetMedium()->GetFilter(); + if (!pMedium) + { + return false; + } + + std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter(); return (pFilter && pFilter->GetFilterName() == "writer_web_HTML_help"); }