summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2020-05-24 12:21:13 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2020-05-24 14:15:34 +0200
commitf2561331534459f8aebc57e8615fa5f626521bcb (patch)
tree11b9d83ec043bcdc6dc214843c33106a098f9fec
parenta64ad061282f8fb0591bb697f1d7e81367964210 (diff)
Prevent deadlock accessing clipboard
Main thread call stack: win32u.dll!NtUserMsgWaitForMultipleObjectsEx() user32.dll!RealMsgWaitForMultipleObjectsEx() combase.dll!CCliModalLoop::BlockFn(void * * ahEvent, unsigned long cEvents, unsigned long * lpdwSignaled) Line 2233 combase.dll!ModalLoop(CSyncClientCall * pClientCall) Line 166 combase.dll!ClassicSTAThreadDispatchCrossApartmentCall(tagRPCOLEMESSAGE * pMessage, OXIDEntry * pOXIDEntry, CSyncClientCall * pClientCall) Line 321 [Inline Frame] combase.dll!CSyncClientCall::SwitchAptAndDispatchCall(tagRPCOLEMESSAGE * pMessage) Line 5696 combase.dll!CSyncClientCall::SendReceive2(tagRPCOLEMESSAGE * pMessage, unsigned long * pstatus) Line 5377 [Inline Frame] combase.dll!SyncClientCallRetryContext::SendReceiveWithRetry(tagRPCOLEMESSAGE *) Line 1617 [Inline Frame] combase.dll!CSyncClientCall::SendReceiveInRetryContext(SyncClientCallRetryContext *) Line 567 combase.dll!ClassicSTAThreadSendReceive(CSyncClientCall * pClientCall, tagRPCOLEMESSAGE * pMsg, unsigned long * pulStatus) Line 549 combase.dll!CSyncClientCall::SendReceive(tagRPCOLEMESSAGE * pMessage, unsigned long * pulStatus) Line 783 combase.dll!CClientChannel::SendReceive(tagRPCOLEMESSAGE * pMessage, unsigned long * pulStatus) Line 653 combase.dll!NdrExtpProxySendReceive(void * pThis, _MIDL_STUB_MESSAGE * pStubMsg) Line 2002 rpcrt4.dll!NdrpClientCall3() rpcrt4.dll!NdrClientCall3() [Inline Frame] combase.dll!IDataObject_RemoteGetData_Proxy(IDataObject *) Line 2082 combase.dll!IDataObject_GetData_Proxy(IDataObject * This, tagFORMATETC * pformatetcIn, tagSTGMEDIUM * pMedium) Line 1270 sysdtrans.dll!CAPNDataObject::GetData(tagFORMATETC * pFormatetc, tagSTGMEDIUM * pmedium) Line 146 sysdtrans.dll!CDOTransferable::getClipboardData(CFormatEtc & aFormatEtc) Line 421 sysdtrans.dll!CDOTransferable::getTransferData(const com::sun::star::datatransfer::DataFlavor & aFlavor) Line 251 vcllo.dll!TransferableDataHelper::GetAny(const com::sun::star::datatransfer::DataFlavor & rFlavor, const rtl::OUString & rDestDoc) Line 1461 vcllo.dll!TransferableDataHelper::GetSequence(const com::sun::star::datatransfer::DataFlavor & rFlavor, const rtl::OUString & rDestDoc) Line 2043 vcllo.dll!TransferableDataHelper::GetSotStorageStream(const com::sun::star::datatransfer::DataFlavor & rFlavor, tools::SvRef<SotStorageStream> & rxStream) Line 2061 vcllo.dll!TransferableDataHelper::GetSotStorageStream(SotClipboardFormatId nFormat, tools::SvRef<SotStorageStream> & rxStream) Line 2055 swlo.dll!SwTransferable::PasteFileContent(TransferableDataHelper & rData, SwWrtShell & rSh, SotClipboardFormatId nFormat, bool bMsg, bool bIgnoreComments) Line 2060 swlo.dll!SwTransferable::PasteData(TransferableDataHelper & rData, SwWrtShell & rSh, unsigned char nAction, SotExchangeActionFlags nActionFlags, SotClipboardFormatId nFormat, SotExchangeDest nDestination, bool bIsPasteFormat, bool bIsDefault, const Point * pPt, char nDropAction, bool bPasteSelection, RndStdIds nAnchorType, bool bIgnoreComments, SwPasteContext * pContext, PasteTableType ePasteTable) Line 1743 swlo.dll!SwTransferable::Paste(SwWrtShell & rSh, TransferableDataHelper & rData, RndStdIds nAnchorType, bool bIgnoreComments, PasteTableType ePasteTable) Line 1576 swlo.dll!SwBaseShell::ExecClpbrd(SfxRequest & rReq) Line 304 swlo.dll!SfxStubSwBaseShellExecClpbrd(SfxShell * pShell, SfxRequest & rReq) Line 2189 sfxlo.dll!SfxShell::CallExec(void(*)(SfxShell *, SfxRequest &) pFunc, SfxRequest & rReq) Line 197 sfxlo.dll!SfxDispatcher::Call_Impl(SfxShell & rShell, const SfxSlot & rSlot, SfxRequest & rReq, bool bRecord) Line 255 sfxlo.dll!SfxDispatcher::Execute_(SfxShell & rShell, const SfxSlot & rSlot, SfxRequest & rReq, SfxCallMode eCallMode) Line 752 sfxlo.dll!SfxBindings::Execute_Impl(SfxRequest & aReq, const SfxSlot * pSlot, SfxShell * pShell) Line 1059 sfxlo.dll!SfxDispatchController_Impl::dispatch(const com::sun::star::util::URL & aURL, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & aArgs, const com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> & rListener) Line 758 sfxlo.dll!SfxOfficeDispatch::dispatchWithNotification(const com::sun::star::util::URL & aURL, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & aArgs, const com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> & rListener) Line 242 fwelo.dll!framework::DispatchHelper::executeDispatch(const com::sun::star::uno::Reference<com::sun::star::frame::XDispatch> & xDispatch, const com::sun::star::util::URL & aURL, bool SyncronFlag, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & lArguments) Line 152 fwelo.dll!framework::DispatchHelper::executeDispatch(const com::sun::star::uno::Reference<com::sun::star::frame::XDispatchProvider> & xDispatchProvider, const rtl::OUString & sURL, const rtl::OUString & sTargetFrameName, long nSearchFlags, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & lArguments) Line 109 unotest.dll!unotest::MacrosTest::dispatchCommand(const com::sun::star::uno::Reference<com::sun::star::lang::XComponent> & xComponent, const rtl::OUString & rCommand, const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & rPropertyValues) Line 77 test_sw_uiwriter.dll!testTdf132187::TestBody() Line 91 test_sw_uiwriter.dll!std::_Invoker_pmf_pointer::_Call<void (__cdecl testTdf132187::*)(void),testTdf132187 * &>(void(testTdf132187::*)() _Pmf, testTdf132187 * & _Arg1) Line 1610 test_sw_uiwriter.dll!std::invoke<void (__cdecl testTdf132187::*&)(void),testTdf132187 * &>(void(testTdf132187::*)() & _Obj, testTdf132187 * & <_Args_0>) Line 1610 test_sw_uiwriter.dll!std::_Invoker_ret<std::_Unforced,0>::_Call<void (__cdecl testTdf132187::*&)(void),testTdf132187 * &>(void(testTdf132187::*)() & <_Vals_0>, testTdf132187 * & <_Vals_1>) Line 1646 test_sw_uiwriter.dll!std::_Call_binder<std::_Unforced,0,void (__cdecl testTdf132187::*)(void),std::tuple<testTdf132187 *>,std::tuple<>>(std::_Invoker_ret<std::_Unforced,0> __formal, std::integer_sequence<unsigned __int64,0> __formal, void(testTdf132187::*)() & _Obj, std::tuple<testTdf132187 *> & _Tpl, std::tuple<> && _Ut) Line 1433 test_sw_uiwriter.dll!std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &>::operator()<>() Line 1473 test_sw_uiwriter.dll!std::_Invoker_functor::_Call<std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &> &>(std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &> & _Obj) Line 1610 test_sw_uiwriter.dll!std::invoke<std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &> &>(std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &> & _Obj) Line 1610 test_sw_uiwriter.dll!std::_Invoker_ret<void,1>::_Call<std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &> &>(std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &> & <_Vals_0>) Line 1629 test_sw_uiwriter.dll!std::_Func_impl_no_alloc<std::_Binder<std::_Unforced,void (__cdecl testTdf132187::*&)(void),testTdf132187 * &>,void>::_Do_call() Line 927 test_sw_uiwriter.dll!std::_Func_class<void>::operator()() Line 977 test_sw_uiwriter.dll!CppUnit::TestCaller<testTdf132187>::runTest() Line 176 cppunitd_dll.dll!CppUnit::TestCaseMethodFunctor::operator()() Line 33 vclbootstrapprotector.dll!`anonymous namespace'::Protector::protect(const CppUnit::Functor & functor, const CppUnit::ProtectorContext & __formal) Line 46 cppunitd_dll.dll!CppUnit::ProtectorChain::ProtectFunctor::operator()() Line 21 unobootstrapprotector.dll!`anonymous namespace'::Prot::protect(const CppUnit::Functor & functor, const CppUnit::ProtectorContext & __formal) Line 79 cppunitd_dll.dll!CppUnit::ProtectorChain::ProtectFunctor::operator()() Line 21 unoexceptionprotector.dll!`anonymous namespace'::Prot::protect(const CppUnit::Functor & functor, const CppUnit::ProtectorContext & context) Line 61 cppunitd_dll.dll!CppUnit::ProtectorChain::ProtectFunctor::operator()() Line 21 cppunitd_dll.dll!CppUnit::DefaultProtector::protect(const CppUnit::Functor & functor, const CppUnit::ProtectorContext & context) Line 15 cppunitd_dll.dll!CppUnit::ProtectorChain::ProtectFunctor::operator()() Line 21 cppunitd_dll.dll!CppUnit::ProtectorChain::protect(const CppUnit::Functor & functor, const CppUnit::ProtectorContext & context) Line 86 cppunitd_dll.dll!CppUnit::TestResult::protect(const CppUnit::Functor & functor, CppUnit::Test * test, const std::string & shortDescription) Line 182 cppunitd_dll.dll!CppUnit::TestCase::run(CppUnit::TestResult * result) Line 91 cppunitd_dll.dll!CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult * controller) Line 65 cppunitd_dll.dll!CppUnit::TestComposite::run(CppUnit::TestResult * result) Line 24 cppunitd_dll.dll!CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult * controller) Line 65 cppunitd_dll.dll!CppUnit::TestComposite::run(CppUnit::TestResult * result) Line 24 cppunitd_dll.dll!CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult * result) Line 47 cppunitd_dll.dll!CppUnit::TestResult::runTest(CppUnit::Test * test) Line 150 cppunitd_dll.dll!CppUnit::TestRunner::run(CppUnit::TestResult & controller, const std::string & testPath) Line 96 cppunittester.exe!`anonymous namespace'::ProtectedFixtureFunctor::run() Line 316 cppunittester.exe!sal_main() Line 466 cppunittester.exe!main(int argc, char * * argv) Line 373 cppunittester.exe!invoke_main() Line 79 cppunittester.exe!__scrt_common_main_seh() Line 288 cppunittester.exe!__scrt_common_main() Line 331 cppunittester.exe!mainCRTStartup() Line 17 kernel32.dll!BaseThreadInitThunk() ntdll.dll!RtlUserThreadStart() The worker thread call stack: ntdll.dll!NtWaitForAlertByThreadId() ntdll.dll!RtlpWaitOnAddressWithTimeout() ntdll.dll!RtlpWaitOnAddress() ntdll.dll!RtlpWaitOnCriticalSection() ntdll.dll!RtlpEnterCriticalSectionContended() ntdll.dll!RtlEnterCriticalSection() sal3.dll!osl_acquireMutex(_oslMutexImpl * Mutex) Line 66 vclplug_winlo.dll!osl::Mutex::acquire() Line 57 vclplug_winlo.dll!SalYieldMutex::doAcquire(unsigned long nLockCount) Line 165 comphelper.dll!comphelper::SolarMutex::acquire(unsigned long nLockCount) Line 87 vcllo.dll!osl::Guard<comphelper::SolarMutex>::Guard<comphelper::SolarMutex>(comphelper::SolarMutex & t) Line 136 vcllo.dll!SolarMutexGuard::SolarMutexGuard() Line 1347 vcllo.dll!TransferableHelper::getTransferData2(const com::sun::star::datatransfer::DataFlavor & rFlavor, const rtl::OUString & rDestDoc) Line 294 vcllo.dll!TransferableHelper::getTransferData(const com::sun::star::datatransfer::DataFlavor & rFlavor) Line 287 sysdtrans.dll!CXTDataObject::renderAnyDataAndSetupStgMedium(tagFORMATETC & fetc, tagSTGMEDIUM & stgmedium) Line 341 sysdtrans.dll!CXTDataObject::GetData(tagFORMATETC * pFormatetc, tagSTGMEDIUM * pmedium) Line 261 sysdtrans.dll!CXNotifyingDataObject::GetData(tagFORMATETC * pFormatetc, tagSTGMEDIUM * pmedium) Line 86 ole32.dll!CClipDataObject::GetData(tagFORMATETC * pformatetc, tagSTGMEDIUM * pmedium) Line 1045 [Inline Frame] combase.dll!IDataObject_GetData_Stub(IDataObject * This, tagFORMATETC *) Line 1291 combase.dll!IDataObject_RemoteGetData_Thunk(_MIDL_STUB_MESSAGE * pStubMsg) Line 2112 rpcrt4.dll!Ndr64StubWorker() rpcrt4.dll!NdrStubCall3() combase.dll!CStdStubBuffer_Invoke(IRpcStubBuffer * This, tagRPCOLEMESSAGE * prpcmsg, IRpcChannelBuffer * pRpcChannelBuffer) Line 1524 [Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing::__l6::<lambda_c9f3956a20c9da92a64affc24fdd69ec>::operator()() Line 1385 combase.dll!ObjectMethodExceptionHandlingAction<<lambda_c9f3956a20c9da92a64affc24fdd69ec>>(InvokeStubWithExceptionPolicyAndTracing::__l6::<lambda_c9f3956a20c9da92a64affc24fdd69ec> action, ObjectMethodExceptionHandlingInfo * pExceptionHandlingInfo, ExceptionHandlingResult * pExceptionHandlingResult, void *) Line 87 [Inline Frame] combase.dll!InvokeStubWithExceptionPolicyAndTracing(IRpcStubBuffer * pMsg, tagRPCOLEMESSAGE *) Line 1383 combase.dll!DefaultStubInvoke(bool bIsAsyncBeginMethod, IServerCall * pServerCall, IRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 1452 [Inline Frame] combase.dll!SyncStubCall::Invoke(IServerCall *) Line 1509 combase.dll!SyncServerCall::StubInvoke(IRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 826 [Inline Frame] combase.dll!StubInvoke(tagRPCOLEMESSAGE * pMsg, CStdIdentity * pStdID, IRpcStubBuffer *) Line 1734 combase.dll!ServerCall::ContextInvoke(tagRPCOLEMESSAGE * pMessage, IRpcStubBuffer * pStub, CServerChannel * pChannel, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 1418 [Inline Frame] combase.dll!CServerChannel::ContextInvoke(tagRPCOLEMESSAGE *) Line 1327 [Inline Frame] combase.dll!DefaultInvokeInApartment(tagRPCOLEMESSAGE *) Line 3352 combase.dll!ReentrantSTAInvokeInApartment(tagRPCOLEMESSAGE * pMsg, unsigned long dwCallCat, bool bIsTouchedASTACall, IRpcStubBuffer * pStub, CServerChannel * pChnl, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 112 combase.dll!AppInvoke(ServerCall * pServerCall, CServerChannel * pChannel, IRpcStubBuffer * pStub, void * pStubBuffer, void * pIPIDEntry, tagIPIDEntry * pLocalb, WireLocalThis *) Line 1182 combase.dll!ComInvokeWithLockAndIPID(ServerCall * pServerCall, tagIPIDEntry * pIPIDEntry, bool * pbCallerResponsibleForRequestMessageCleanup) Line 2290 [Inline Frame] combase.dll!ComInvoke(ServerCall *) Line 1803 [Inline Frame] combase.dll!ThreadDispatch(ServerCall *) Line 416 combase.dll!ThreadWndProc(HWND__ * window, unsigned int message, unsigned __int64 wparam, __int64 params) Line 744 user32.dll!UserCallWinProcCheckWow() user32.dll!DispatchMessageWorker() sysdtrans.dll!CMtaOleClipboard::run() Line 652 sysdtrans.dll!CMtaOleClipboard::oleThreadProc(void * pParam) Line 673 ucrtbased.dll!thread_start<unsigned int (__cdecl*)(void *),1>(void * const parameter) Line 97 kernel32.dll!BaseThreadInitThunk() ntdll.dll!RtlUserThreadStart() Main thread acquires solar mutex in SfxDispatchController_Impl::dispatch, and calls IDataObject::GetData. Worker thread serves the call, and waits for the solar mutex => deadlock. Change-Id: Ic408a779af9390531d1fc4272995f12849716a87 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94679 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
-rw-r--r--vcl/source/treelist/transfer.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 51f6f2e14f8f..965d820e331e 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -1442,6 +1442,10 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& r
{
if( ( nRequestFormat == format.mnSotId ) && !rFlavor.MimeType.equalsIgnoreAsciiCase( format.MimeType ) )
{
+ // Our own thread may handle the nested IDataObject::GetData call,
+ // and try to acquire solar mutex
+ SolarMutexReleaser r;
+
if (xTransfer2.is())
aRet = xTransfer2->getTransferData2(format, rDestDoc);
else
@@ -1455,6 +1459,10 @@ Any TransferableDataHelper::GetAny( const DataFlavor& rFlavor, const OUString& r
if( !aRet.hasValue() )
{
+ // Our own thread may handle the nested IDataObject::GetData call,
+ // and try to acquire solar mutex
+ SolarMutexReleaser r;
+
if (xTransfer2.is())
aRet = xTransfer2->getTransferData2(rFlavor, rDestDoc);
else