diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2023-02-08 09:22:20 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2023-02-08 09:18:41 +0000 |
commit | 6f91ab6de9ce169ca489f4574b119e06ef6db9dc (patch) | |
tree | 4e79ae16faf9b8a25211e920d32427d14ade5449 /basctl | |
parent | e1e6ff49a244039bc2c2c09026ab9ca3ef96e859 (diff) |
Avoid SolarMutexReleaser
UITest_writer_macro_tests occasionally failed with
> ==3730889==ERROR: AddressSanitizer: heap-use-after-free on address 0x60d00057d080 at pc 0x7f75353d933c bp 0x7ffcedf8de90 sp 0x7ffcedf8de88
> READ of size 8 at 0x60d00057d080 thread T0
> #0 in basctl::ModulWindow::GetState(SfxItemSet&) at basctl/source/basicide/baside2.cxx:1088:22
> #1 in basctl::Shell::GetState(SfxItemSet&) at basctl/source/basicide/basides1.cxx:1160:18
> #2 in SfxStubbasctl_ShellGetState(SfxShell*, SfxItemSet&) at workdir/SdiTarget/basctl/sdi/basslots.hxx:164:1
> #3 in SfxDispatcher::FillState_(SfxSlotServer const&, SfxItemSet&, SfxSlot const*) at sfx2/source/control/dispatch.cxx:1658:9
> #4 in SfxBindings::Update_Impl(SfxStateCache&) at sfx2/source/control/bindings.cxx:260:22
> #5 in SfxBindings::NextJob_Impl(Timer const*) at sfx2/source/control/bindings.cxx:1275:17
> #6 in SfxBindings::NextJob(Timer*) at sfx2/source/control/bindings.cxx:1220:5
> #7 in SfxBindings::LinkStubNextJob(void*, Timer*) at sfx2/source/control/bindings.cxx:1218:1
> #8 in Link<Timer*, void>::Call(Timer*) const at include/tools/link.hxx:111:45
> #9 in Timer::Invoke() at vcl/source/app/timer.cxx:75:21
> #10 in Scheduler::CallbackTaskScheduling() at vcl/source/app/scheduler.cxx:481:20
> #11 in SalTimer::CallCallback() at vcl/inc/saltimer.hxx:54:13
> #12 in SvpSalInstance::CheckTimeout(bool) at vcl/headless/svpinst.cxx:161:53
> #13 in SvpSalInstance::ImplYield(bool, bool) at vcl/headless/svpinst.cxx:399:17
> #14 in SvpSalInstance::DoYield(bool, bool) at vcl/headless/svpinst.cxx:471:21
> #15 in ImplYield(bool, bool) at vcl/source/app/svapp.cxx:475:48
> #16 in Application::Yield() at vcl/source/app/svapp.cxx:559:5
> #17 in Application::Execute() at vcl/source/app/svapp.cxx:453:13
> #18 in desktop::Desktop::Main() at desktop/source/app/app.cxx:1604:13
> #19 in ImplSVMain() at vcl/source/app/svmain.cxx:203:35
> #20 in SVMain() at vcl/source/app/svmain.cxx:235:12
> #21 in soffice_main at desktop/source/app/sofficemain.cxx:94:12
> #22 in sal_main at desktop/source/app/main.c:51:15
> #23 in main at desktop/source/app/main.c:49:1
>
> 0x60d00057d080 is located 0 bytes inside of 144-byte region [0x60d00057d080,0x60d00057d110)
> freed by thread T20 here:
> #0 in operator delete(void*, unsigned long) at /home/sbergman/github.com/llvm/llvm-project/compiler-rt/lib/asan/asan_new_delete.cpp:164:3
> #1 in basctl::ModulWindow::~ModulWindow() at basctl/source/basicide/baside2.cxx:235:1
> #2 in VclReferenceBase::release() const at include/vcl/vclreferencebase.hxx:43:13
> #3 in rtl::Reference<basctl::BaseWindow>::~Reference() at include/rtl/ref.hxx:129:22
> #4 in VclPtr<basctl::BaseWindow>::disposeAndClear() at include/vcl/vclptr.hxx:209:5
> #5 in basctl::Shell::~Shell() at basctl/source/basicide/basidesh.cxx:246:23
> #6 in basctl::Shell::~Shell() at basctl/source/basicide/basidesh.cxx:228:1
> #7 in SfxViewFrame::ReleaseObjectShell_Impl() at sfx2/source/view/viewfrm.cxx:1114:9
> #8 in SfxViewFrame::~SfxViewFrame() at sfx2/source/view/viewfrm.cxx:1905:5
> #9 in SfxViewFrame::Close() at sfx2/source/view/viewfrm.cxx:1166:5
> #10 in SfxFrame::DoClose_Impl() at sfx2/source/view/frame.cxx:138:37
> #11 in SfxBaseController::dispose() at sfx2/source/view/sfxbasecontroller.cxx:931:28
> #12 in (anonymous namespace)::XFrameImpl::setComponent(com::sun::star::uno::Reference<com::sun::star::awt::XWindow> const&, com::sun::star::uno::Reference<com::sun::star::frame::XController> const&) at framework/source/services/frame.cxx:1493:33
> #13 in (anonymous namespace)::XFrameImpl::close(unsigned char) at framework/source/services/frame.cxx:1704:12
> #14 in SfxFrame::DoClose() at sfx2/source/view/frame.cxx:104:29
> #15 in SfxViewFrame::Notify(SfxBroadcaster&, SfxHint const&) at sfx2/source/view/viewfrm.cxx:1703:28
> #16 in SfxBroadcaster::Broadcast(SfxHint const&) at svl/source/notify/SfxBroadcaster.cxx:40:24
> #17 in (anonymous namespace)::SfxModelListener_Impl::notifyClosing(com::sun::star::lang::EventObject const&) at sfx2/source/doc/objxtor.cxx:145:12
> #18 in SfxBaseModel::close(unsigned char) at sfx2/source/doc/sfxbasemodel.cxx:1487:76
> #19 in SfxBaseModel::dispose() at sfx2/source/doc/sfxbasemodel.cxx:725:13
> #20 in gcc3::callVirtualMethod(void*, unsigned int, void*, _typelib_TypeDescriptionReference*, bool, unsigned long*, unsigned int, unsigned long*, double*) at bridges/source/cpp_uno/gcc3_linux_x86-64/callvirtualmethod.cxx:77:5
> #21 in cpp_call(bridges::cpp_uno::shared::UnoInterfaceProxy*, bridges::cpp_uno::shared::VtableSlot, _typelib_TypeDescriptionReference*, int, _typelib_MethodParameter*, void*, void**, _uno_Any**) at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:233:13
> #22 in unoInterfaceProxyDispatch at bridges/source/cpp_uno/gcc3_linux_x86-64/uno2cpp.cxx:413:13
> #23 in binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny*, std::__debug::vector<binaryurp::BinaryAny, std::allocator<binaryurp::BinaryAny>>*) const at binaryurp/source/incomingrequest.cxx:236:13
> #24 in binaryurp::IncomingRequest::execute() const at binaryurp/source/incomingrequest.cxx:79:26
> #25 in request at binaryurp/source/reader.cxx:86:9
> #26 in cppu_threadpool::JobQueue::enter(void const*, bool) at cppu/source/threadpool/jobqueue.cxx:100:17
> #27 in cppu_threadpool::ORequestThread::run() at cppu/source/threadpool/thread.cxx:165:31
> #28 in threadFunc at include/osl/thread.hxx:189:15
> #29 in osl_thread_start_Impl(void*) at sal/osl/unx/thread.cxx:265:9
where the ModulWindow apparently happens to get deleted by the UNO worker thread
in the window of time when ModuleWindow::IsPasteAllowed temporarily dropped the
SolarMutex on the main thread.
Temporarily dropping the SolarMutex around the xClipboard->getContents() call
had been there ever since the code got introduced in
c29c7a86c8cb18d0e0602cddb3f24373e2424098 "#92173# Reimplement Basic password
protection UI in Basic IDE", and at least theoretically it is of course the
right thing to do to not call that UNO API with the SolarMutex locked. But it
is of course also not a good idea to use SolarMutexReleaser, and that
xClipboard->getContents() call doesn't look like it leads to deadlock.
Change-Id: I3660065508d37801125f675440071d61e41906d1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146650
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside2.cxx | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx index 31fee2eeccb4..60f0ccaa4332 100644 --- a/basctl/source/basicide/baside2.cxx +++ b/basctl/source/basicide/baside2.cxx @@ -1381,12 +1381,7 @@ bool ModulWindow::IsPasteAllowed() if ( xClipboard.is() ) { - Reference< datatransfer::XTransferable > xTransf; - { - SolarMutexReleaser aReleaser; - // get clipboard content - xTransf = xClipboard->getContents(); - } + Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents(); if ( xTransf.is() ) { datatransfer::DataFlavor aFlavor; |