sw/source/core/docnode/section.cxx | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-)
New commits: commit bbb53997c3a6890567ee991aed8502b397dcb7a6 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Jan 7 16:07:50 2025 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Jan 7 18:08:00 2025 +0100 fix ubsan failure since commit 404fbec25740406e3b926844f3bd0f324dc38b8c Author: Noel Grandin <noelgran...@gmail.com> Date: Sat Jan 4 16:20:57 2025 +0200 convert RES_ATTRSET_CHG to SfxHint where the code is incorrectly continuing, and thus doing an invalid downcast Change-Id: I04f69e73fc14c7ba04ef619ef7647320931d9a51 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/179890 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 62bbbd2c2ed1..b78c08ce8143 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -713,14 +713,12 @@ void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) if(!pSect || rSectionHidden.m_isHidden == pSect->IsHiddenFlag()) // already at target state, skipping. return; GetNotifier().Broadcast(rSectionHidden); - return; } else if(SfxHintId::SwRemoveUnoObject == rHint.GetId()) { SwFrameFormat::SwClientNotify(rMod, rHint); // invalidate cached uno object SetXTextSection(nullptr); - return; } else if (rHint.GetId() == SfxHintId::SwFormatChange) { @@ -735,7 +733,6 @@ void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) return; } SwFrameFormat::SwClientNotify(rMod, rHint); - return; } else if (rHint.GetId() == SfxHintId::SwAttrSetChange) { @@ -797,23 +794,24 @@ void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint) } SwFrameFormat::SwClientNotify(rMod, rHint); } - else if (rHint.GetId() != SfxHintId::SwLegacyModify) - return; - auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint); - sal_uInt16 nWhich = pLegacy->GetWhich(); - auto pOld = pLegacy->m_pOld; - auto pNew = pLegacy->m_pNew; - switch( nWhich ) + else if (rHint.GetId() == SfxHintId::SwLegacyModify) { - case RES_FTN_AT_TXTEND: - case RES_END_AT_TXTEND: - case RES_PROTECT: - case RES_EDIT_IN_READONLY: // edit in readonly sections - // Pass through these Messages until the End of the tree! - GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew)); - return; // That's it! + auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint); + sal_uInt16 nWhich = pLegacy->GetWhich(); + auto pOld = pLegacy->m_pOld; + auto pNew = pLegacy->m_pNew; + switch( nWhich ) + { + case RES_FTN_AT_TXTEND: + case RES_END_AT_TXTEND: + case RES_PROTECT: + case RES_EDIT_IN_READONLY: // edit in readonly sections + // Pass through these Messages until the End of the tree! + GetNotifier().Broadcast(sw::LegacyModifyHint(pOld, pNew)); + return; // That's it! + } + SwFrameFormat::SwClientNotify(rMod, rHint); } - SwFrameFormat::SwClientNotify(rMod, rHint); } void SwSectionFormat::SetXTextSection(rtl::Reference<SwXTextSection> const& xTextSection)