summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2023-11-06 15:44:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2023-11-07 07:05:29 +0100
commitc662c66829187e5e1ccf6cba752928b7056a4cab (patch)
treea274d449ca42c12a4e7d7fef42d86633d2847a7e
parentee38eea6dd2ef487a4a6014ed2a36f46946648c7 (diff)
Fix SwLanguageIterator::Next for RES_TXTATR_AUTOFMT
...following advice by mstahl, as discussed in the comments starting at <https://gerrit.libreoffice.org/c/core/+/158732/2#message-053bc195667ee3ba396ed12a85f3af8d4b7e5efc> "tdf#157667 sw track changes: fix cycle case on multiple words", which had started to cause > /sw/inc/txatritr.hxx:69:18: runtime error: downcast of address 0x603001b45d90 which does not point to an object of type 'const SvxLanguageItem' > 0x603001b45d90: note: object is of type 'SwFormatAutoFormat' > 00 00 00 00 f0 0f 53 4e 3b 7f 00 00 02 00 00 00 32 00 90 be 20 31 36 00 80 60 00 00 c0 5d b4 01 > ^~~~~~~~~~~~~~~~~~~~~~~ > vptr for 'SwFormatAutoFormat' > #0 0x7f3b45ef75d2 in SwLanguageIterator::GetLanguage() const /sw/inc/txatritr.hxx:69:18 > #1 0x7f3b45ee2765 in SwTextNode::TransliterateText(utl::TransliterationWrapper&, int, int, SwUndoTransliterate*, bool) /sw/source/core/txtnode/txtedt.cxx:1980:32 > #2 0x7f3b429f1d40 in sw::DocumentContentOperationsManager::TransliterateText(SwPaM const&, utl::TransliterationWrapper&) /sw/source/core/doc/DocumentContentOperationsManager.cxx:3186:15 > #3 0x7f3b43a52777 in SwEditShell::TransliterateText(TransliterationFlags) /sw/source/core/edit/editsh.cxx:1076:51 > #4 0x7f3b49118c97 in SwTextShell::ExecRotateTransliteration(SfxRequest const&) /sw/source/uibase/shells/textsh.cxx:866:20 > #5 0x7f3b49118984 in SfxStubSwTextShellExecRotateTransliteration(SfxShell*, SfxRequest&) /workdir/SdiTarget/sw/sdi/swslots.hxx:3194:1 > #6 0x7f3b6529ff75 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:254:9 > #7 0x7f3b652b5e85 in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:753:9 > #8 0x7f3b65240e3b in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1061:22 > #9 0x7f3b656c2760 in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:688:53 > #10 0x7f3b656c4ec1 in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:266:16 > #11 0x7f3b193705a6 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> const&, com::sun::star::util::URL const&, bool, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:163:30 > #12 0x7f3b1936f482 in framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx:120:16 > #13 0x7f3b19370e54 in non-virtual thunk to framework::DispatchHelper::executeDispatch(com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> const&, rtl::OUString const&, rtl::OUString const&, int, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /framework/source/services/dispatchhelper.cxx > #14 0x7f3b3810b5e9 in unotest::MacrosTest::dispatchCommand(com::sun::star::uno::Reference<com::sun::star::lang::XComponent> const&, rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&) /unotest/source/cpp/macros_test.cxx:94:33 > #15 0x7f3b7245e5fd in testTdf157667::TestBody() /sw/qa/extras/uiwriter/uiwriter6.cxx:793:5 Change-Id: I0e0545a134d86a333b971da83a66f58c5e70f601 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/159002 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
-rw-r--r--sw/source/core/txtnode/txatritr.cxx9
1 files changed, 2 insertions, 7 deletions
diff --git a/sw/source/core/txtnode/txatritr.cxx b/sw/source/core/txtnode/txatritr.cxx
index 883c09760c33..91aed778c157 100644
--- a/sw/source/core/txtnode/txatritr.cxx
+++ b/sw/source/core/txtnode/txatritr.cxx
@@ -126,13 +126,8 @@ bool SwLanguageIterator::Next()
m_nChgPos = nEndPos;
m_nAttrPos = nSavePos;
- if( RES_TXTATR_CHARFMT == pHt->Which() )
- {
- const sal_uInt16 nWId = GetWhichOfScript( RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() );
- m_pCurrentItem = &pHt->GetCharFormat().GetCharFormat()->GetFormatAttr(nWId);
- }
- else
- m_pCurrentItem = &pHt->GetAttr();
+ const sal_uInt16 nWId = GetWhichOfScript( RES_CHRATR_LANGUAGE, m_aScriptIter.GetCurrScript() );
+ m_pCurrentItem = CharFormat::GetItem(*pHt, nWId);
m_aStack.pop_front();
}