sw/source/core/unocore/unoframe.cxx | 2 ++ 1 file changed, 2 insertions(+)
New commits: commit f45402ae3f5241b460d9f1dcb04183893e1f91f7 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Fri Mar 15 11:06:40 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Fri Mar 15 08:55:24 2024 +0100 Fix a spurious JunitTest_sw_unoapi_3 failure As seen e.g. in https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/146433/consoleFull#-456117562b3c3940-aa94-44b1-926f-2d1e7de0f995 which starts with: o3tl::iterateCodePoints(std::u16string_view, sal_Int32 *, sal_Int32): Assertion `n <= string.length()' failed. The problem is the race between the request thread performing changes of the document model, and main thread doing idle tasks accessing the document model concurrently, as seen in the following call stacks: cppu_threadpool::ORequestThread sal3.dll!osl_waitCondition(void * Condition, const TimeValue * pTimeout) Line 82 vcllo.dll!osl::Condition::wait(const TimeValue * pTimeout) Line 124 vcllo.dll!Scheduler::IdlesLockGuard::IdlesLockGuard() Line 290 swlo.dll!sw::DocumentLayoutManager::DelLayoutFormat(SwFrameFormat * pFormat) Line 197 swlo.dll!SwTextNode::DestroyAttr(SwTextAttr * pAttr) Line 1204 swlo.dll!SwTextNode::EraseText(const SwContentIndex & rIdx, const long nCount, const SwInsertFlags nMode) Line 2836 swlo.dll!SwTextNode::DeleteAttributes(const unsigned short nWhich, const long nStart, const long nEnd) Line 1861 swlo.dll!SwXFrame::dispose() Line 2703 swlo.dll!SwXTextFrame::dispose() Line 3383 mscx_uno.dll!`anonymous namespace'::cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy * pThis, bridges::cpp_uno::shared::VtableSlot aVtableSlot, _typelib_TypeDescriptionReference * pReturnTypeRef, long nParams, _typelib_MethodParameter * pParams, void * pUnoReturn, void * * pUnoArgs, _uno_Any * * ppUnoExc) Line 214 mscx_uno.dll!unoInterfaceProxyDispatch(_uno_Interface * pUnoI, const _typelib_TypeDescription * pMemberTD, void * pReturn, void * * pArgs, _uno_Any * * ppException) Line 430 binaryurplo.dll!binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny * returnValue, std::vector<binaryurp::BinaryAny,std::allocator<binaryurp::BinaryAny>> * outArguments) Line 239 binaryurplo.dll!binaryurp::IncomingRequest::execute() Line 79 binaryurplo.dll!request(void * pThreadSpecificData) Line 84 cppu3.dll!cppu_threadpool::JobQueue::enter(const void * nDisposeId, bool bReturnWhenNoJob) Line 101 cppu3.dll!cppu_threadpool::ORequestThread::run() Line 169 cppu3.dll!threadFunc(void * param) Line 190 sal3.dll!oslWorkerWrapperFunction(void * pData) Line 69 ucrtbased.dll!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Line 97 kernel32.dll!BaseThreadInitThunk() ntdll.dll!RtlUserThreadStart() VCL Main ucrtbased.dll!_wassert(const wchar_t * expression, const wchar_t * file_name, unsigned int line_number) Line 444 sal3.dll!o3tl::iterateCodePoints<long>(std::basic_string_view<char16_t,std::char_traits<char16_t>> string, long * indexUtf16, long incrementCodePoints) Line 522 sal3.dll!rtl_uString_iterateCodePoints(const _rtl_uString * string, long * indexUtf16, long incrementCodePoints) Line 754 i18npoollo.dll!rtl::OUString::iterateCodePoints(long * indexUtf16, long incrementCodePoints) Line 3015 i18npoollo.dll!i18npool::BreakIterator_Unicode::previousCharacters(const rtl::OUString & Text, long nStartPos, const com::sun::star::lang::Locale & rLocale, short nCharacterIteratorMode, long nCount, long & nDone) Line 344 i18npoollo.dll!i18npool::BreakIteratorImpl::previousCharacters(const rtl::OUString & Text, long nStartPos, const com::sun::star::lang::Locale & rLocale, short nCharacterIteratorMode, long nCount, long & nDone) Line 72 swlo.dll!SwContentNode::GoPrevious(SwContentIndex * pIdx, SwCursorSkipMode nMode) Line 1345 swlo.dll!SwEditShell::GetScriptType() Line 686 swlo.dll!SwTextShell::GetState(SfxItemSet & rSet) Line 2246 swlo.dll!SfxStubSwTextShellGetState(SfxShell * pShell, SfxItemSet & rSet) Line 3180 sfxlo.dll!SfxDispatcher::FillState_(const SfxSlotServer & rSvr, SfxItemSet & rState, const SfxSlot * pRealSlot) Line 1694 sfxlo.dll!SfxBindings::Update_Impl(SfxStateCache & rCache) Line 262 sfxlo.dll!SfxBindings::NextJob_Impl(const Timer * pTimer) Line 1275 sfxlo.dll!SfxBindings::NextJob(Timer * pTimer) Line 1219 sfxlo.dll!SfxBindings::LinkStubNextJob(void * instance, Timer * data) Line 1214 vcllo.dll!Link<Timer *,void>::Call(Timer * data) Line 111 vcllo.dll!Timer::Invoke() Line 76 vcllo.dll!Scheduler::CallbackTaskScheduling() Line 508 vcllo.dll!SalTimer::CallCallback() Line 55 vclplug_winlo.dll!WinSalTimer::ImplHandleElapsedTimer() Line 168 vclplug_winlo.dll!WinSalTimer::ImplHandleTimerEvent(unsigned __int64 aWPARAM) Line 178 vclplug_winlo.dll!SalComWndProc(HWND__ * __formal, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam, bool & rDef) Line 720 vclplug_winlo.dll!SalComWndProcW(HWND__ * hWnd, unsigned int nMsg, unsigned __int64 wParam, __int64 lParam) Line 749 user32.dll!UserCallWinProcCheckWow() user32.dll!DispatchMessageWorker() vclplug_winlo.dll!ImplSalDispatchMessage(const tagMSG * pMsg) Line 475 vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents) Line 552 vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool bHandleAllCurrentEvents) Line 581 vcllo.dll!ImplYield(bool i_bWait, bool i_bAllEvents) Line 394 vcllo.dll!Application::Yield() Line 483 vcllo.dll!Application::Execute() Line 370 sofficeapp.dll!desktop::Desktop::Main() Line 1614 vcllo.dll!ImplSVMain() Line 229 vcllo.dll!SVMain() Line 262 sofficeapp.dll!soffice_main() Line 94 soffice.bin!sal_main() Line 51 soffice.bin!main(int argc, char * * argv) Line 49 soffice.bin!invoke_main() Line 79 soffice.bin!__scrt_common_main_seh() Line 288 soffice.bin!__scrt_common_main() Line 331 soffice.bin!mainCRTStartup(void * __formal) Line 17 kernel32.dll!BaseThreadInitThunk() ntdll.dll!RtlUserThreadStart() The infrastructure introduced in commit 3e0a2239e977a2d6f5252b2412378e02dde3a8b8 (Introduce a guard to delay processing of idles, 2024-03-13) happens to fit this problem nicely. I am sure that some other Java unit test failures (crashes) seen in CI are also caused by similar problems, and need a similar solution, to address an actual bug. Change-Id: I3a765cf0a6273af568e353e22b68107b78578762 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164854 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 8e3132d2e8b8..f8509ad4626c 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -99,6 +99,7 @@ #include <ndtxt.hxx> #include <ndgrf.hxx> #include <mutex> +#include <vcl/scheduler.hxx> #include <vcl/svapp.hxx> #include <vcl/GraphicLoader.hxx> #include <SwStyleNameMapper.hxx> @@ -2680,6 +2681,7 @@ void SwXFrame::Notify(const SfxHint& rHint) void SwXFrame::dispose() { SolarMutexGuard aGuard; + Scheduler::IdlesLockGuard g; SwFrameFormat* pFormat = GetFrameFormat(); if (!pFormat) return;