embeddedobj/source/msole/olecomponent.cxx |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

New commits:
commit 47d8d0cbe73ae4050b3264a465efa695dc621bf2
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Wed Sep 4 14:38:23 2024 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Wed Sep 4 16:56:07 2024 +0200

    Avoid deadlock
    
    Seen when running an external Java code, with these call stacks:
    
    Main thread:
    
     win32u.dll!NtUserMsgWaitForMultipleObjectsEx()
     sal3.dll!osl_waitCondition(void * Condition, const TimeValue * pTimeout)
     [Inline Frame] vclplug_winlo.dll!osl::Condition::wait(const TimeValue *)
     vclplug_winlo.dll!SalYieldMutex::doAcquire(unsigned long nLockCount)
     [Inline Frame] emboleobj.dll!SolarMutexReleaser::{dtor}()
     emboleobj.dll!OleComponent::getTransferData(const 
com::sun::star::datatransfer::DataFlavor & aFlavor)
     emboleobj.dll!OleEmbeddedObject::getPreferredVisualRepresentation(__int64 
nAspect)
     
comphelper.dll!comphelper::EmbeddedObjectContainer::GetGraphicReplacementStream(__int64
 nViewAspect, const 
com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> & xObj, 
rtl::OUString * pMediaType)
     [Inline Frame] 
svtlo.dll!svt::EmbeddedObjectRef::GetGraphicReplacementStream(__int64)
     svtlo.dll!svt::EmbeddedObjectRef::GetGraphicStream(bool bUpdate)
     svtlo.dll!svt::EmbeddedObjectRef::GetReplacement(bool bUpdate)
     svtlo.dll!svt::EmbeddedObjectRef::UpdateReplacement(bool bUpdateOle)
     swlo.dll!SwWrtShell::CalcAndSetScale(svt::EmbeddedObjectRef & xObj, const 
SwRect * pFlyPrtRect, const SwRect * pFlyFrameRect, const bool 
bNoTextFramePrtAreaChanged)
     swlo.dll!SwContentNotify::ImplDestroy()
     swlo.dll!SwContentNotify::~SwContentNotify()
     swlo.dll!SwNoTextFrame::MakeAll(OutputDevice * pRenderContext)
     swlo.dll!SwFrame::OptPrepareMake()
     [Inline Frame] swlo.dll!SwFrame::OptCalc()
     swlo.dll!SwLayAction::FormatContent_(const SwContentFrame * pContent, 
const SwPageFrame * pPage)
     swlo.dll!SwLayAction::FormatFlyContent(const SwFlyFrame * pFly)
     swlo.dll!SwObjectFormatter::FormatObj_(SwAnchoredObject & _rAnchoredObj)
     swlo.dll!SwObjectFormatterTextFrame::DoFormatObj(SwAnchoredObject & 
_rAnchoredObj, const bool _bCheckForMovedFwd)
     swlo.dll!SwObjectFormatter::FormatObjsAtFrame_(SwTextFrame * 
_pMasterTextFrame)
     swlo.dll!SwObjectFormatterTextFrame::DoFormatObjs()
     swlo.dll!SwObjectFormatter::FormatObjsAtFrame(SwFrame & _rAnchorFrame, 
const SwPageFrame & _rPageFrame, SwLayAction * _pLayAction)
     swlo.dll!SwLayAction::FormatContent(SwPageFrame * pPage)
     swlo.dll!SwLayAction::InternalAction(OutputDevice * pRenderContext)
     [Inline Frame] swlo.dll!SwLayAction::Action(OutputDevice * pRenderContext)
     swlo.dll!SwLayIdle::SwLayIdle(SwRootFrame * pRt, SwViewShellImp * pI)
     swlo.dll!SwViewShell::LayoutIdle()
     swlo.dll!sw::DocumentTimerManager::DoIdleJobs(Timer * __formal)
     vcllo.dll!Scheduler::CallbackTaskScheduling()
     vclplug_winlo.dll!WinSalTimer::ImplHandleElapsedTimer()
     vclplug_winlo.dll!ImplSalYield(bool bWait, bool bHandleAllCurrentEvents)
     vclplug_winlo.dll!WinSalInstance::DoYield(bool bWait, bool 
bHandleAllCurrentEvents)
     vcllo.dll!ImplYield(bool i_bWait, bool i_bAllEvents)
     vcllo.dll!Application::Execute()
     sofficeapp.dll!desktop::Desktop::Main()
     vcllo.dll!ImplSVMain()
     sofficeapp.dll!soffice_main()
     [Inline Frame] soffice.bin!sal_main()
     soffice.bin!main(int argc, char * * argv)
     [Inline Frame] soffice.bin!invoke_main()
     soffice.bin!__scrt_common_main_seh()
     kernel32.dll!BaseThreadInitThunk()
     ntdll.dll!RtlUserThreadStart()
    
    Request thread:
    
     ntdll.dll!NtWaitForAlertByThreadId()
     ntdll.dll!RtlpWaitOnCriticalSection()
     ntdll.dll!RtlpEnterCriticalSectionContended()
     ntdll.dll!RtlEnterCriticalSection()
     sal3.dll!osl_acquireMutex(_oslMutexImpl * Mutex)
     [Inline Frame] emboleobj.dll!osl::Mutex::acquire()
     [Inline Frame] emboleobj.dll!osl::Guard<osl::Mutex>::{ctor}(osl::Mutex &)
     emboleobj.dll!OleComponent::addModifyListener(const 
com::sun::star::uno::Reference<com::sun::star::util::XModifyListener> & 
xListener)
     svtlo.dll!svt::`anonymous 
namespace'::EmbedEventListener_Impl::Create(svt::EmbeddedObjectRef * p)
     svtlo.dll!svt::EmbeddedObjectRef::EmbeddedObjectRef(const 
com::sun::star::uno::Reference<com::sun::star::embed::XEmbeddedObject> & xObj, 
__int64 nAspect)
     swlo.dll!SwXFrame::getPropertyValue(const rtl::OUString & rPropertyName)
     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)
     mscx_uno.dll!unoInterfaceProxyDispatch(_uno_Interface * pUnoI, const 
_typelib_TypeDescription * pMemberTD, void * pReturn, void * * pArgs, _uno_Any 
* * ppException)
     
binaryurplo.dll!binaryurp::IncomingRequest::execute_throw(binaryurp::BinaryAny 
* returnValue, 
std::vector<binaryurp::BinaryAny,std::allocator<binaryurp::BinaryAny>> * 
outArguments)
     binaryurplo.dll!binaryurp::IncomingRequest::execute()
     binaryurplo.dll!request(void * pThreadSpecificData)
     cppu3.dll!cppu_threadpool::JobQueue::enter(const void * nDisposeId, bool 
bReturnWhenNoJob)
     cppu3.dll!cppu_threadpool::ORequestThread::run()
     cppu3.dll!threadFunc(void * param)
     sal3.dll!oslWorkerWrapperFunction(void * pData)
     ucrtbase.dll!thread_start<unsigned int (__cdecl*)(void *),1>()
     kernel32.dll!BaseThreadInitThunk()
     ntdll.dll!RtlUserThreadStart()
    
    Change-Id: I54d3fd91d8bbf4f52eee2f498c91e06ebc82d836
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172864
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/embeddedobj/source/msole/olecomponent.cxx 
b/embeddedobj/source/msole/olecomponent.cxx
index 0ba34a7d7051..a520781f14c9 100644
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ b/embeddedobj/source/msole/olecomponent.cxx
@@ -1542,7 +1542,7 @@ void SAL_CALL OleComponent::removeCloseListener( const 
uno::Reference< util::XCl
 
 uno::Any SAL_CALL OleComponent::getTransferData( const 
datatransfer::DataFlavor& aFlavor )
 {
-    ::osl::MutexGuard aGuard( m_aMutex );
+    ::osl::ResettableMutexGuard aGuard( m_aMutex );
     if ( m_bDisposed )
         throw lang::DisposedException(); // TODO
 
@@ -1586,6 +1586,7 @@ uno::Any SAL_CALL OleComponent::getTransferData( const 
datatransfer::DataFlavor&
 
                 HRESULT hr;
                 {
+                    osl::ResettableMutexGuardScopedReleaser 
own_releaser(aGuard);
                     SolarMutexReleaser releaser;
                     hr = pDataObject->GetData(&aFormat, &aMedium);
                 }

Reply via email to