Kaydet (Commit) 0364d3b7 authored tarafından Michael Stahl's avatar Michael Stahl

fdo#46678: pyuno: fix deadlock in Runtime::any2PyObject()

When calling XUnoTunnel::getSomething(), the function must drop the
CPython GIL to avoid deadlock since there are implementations of
XUnoTunnel that acquire SolarMutex.

Change-Id: I51ffce9bdee9a51c932902e77856f865eae81d2a
üst ef8b94ab
...@@ -550,13 +550,19 @@ PyRef Runtime::any2PyObject (const Any &a ) const ...@@ -550,13 +550,19 @@ PyRef Runtime::any2PyObject (const Any &a ) const
} }
case typelib_TypeClass_INTERFACE: case typelib_TypeClass_INTERFACE:
{ {
Reference< XUnoTunnel > tunnel; // fdo#46678 must unlock GIL because getSomething could acquire locks,
a >>= tunnel; // and queryInterface too...
if( tunnel.is() )
{ {
sal_Int64 that = tunnel->getSomething( ::pyuno::Adapter::getUnoTunnelImplementationId() ); PyThreadDetach d;
if( that )
return ((Adapter*)sal::static_int_cast< sal_IntPtr >(that))->getWrappedObject(); Reference<XUnoTunnel> tunnel;
a >>= tunnel;
if (tunnel.is())
{
sal_Int64 that = tunnel->getSomething( ::pyuno::Adapter::getUnoTunnelImplementationId() );
if( that )
return ((Adapter*)sal::static_int_cast< sal_IntPtr >(that))->getWrappedObject();
}
} }
//This is just like the struct case: //This is just like the struct case:
return PyRef( PyUNO_new (a, getImpl()->cargo->xInvocation), SAL_NO_ACQUIRE ); return PyRef( PyUNO_new (a, getImpl()->cargo->xInvocation), SAL_NO_ACQUIRE );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment