summaryrefslogtreecommitdiff
path: root/pyuno
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2014-08-28 15:11:37 +0200
committerMichael Stahl <mstahl@redhat.com>2014-08-28 16:16:01 +0200
commit0364d3b7e670bddb49d5132268cf28737c3301c6 (patch)
tree11b2c5506f2e2855cea95b7beb3165f124997d60 /pyuno
parentef8b94ab0e689851871f9783d4b1f3724177cf3a (diff)
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
Diffstat (limited to 'pyuno')
-rw-r--r--pyuno/source/module/pyuno_runtime.cxx18
1 files changed, 12 insertions, 6 deletions
diff --git a/pyuno/source/module/pyuno_runtime.cxx b/pyuno/source/module/pyuno_runtime.cxx
index c6d1629c6717..9023d3958af3 100644
--- a/pyuno/source/module/pyuno_runtime.cxx
+++ b/pyuno/source/module/pyuno_runtime.cxx
@@ -550,13 +550,19 @@ PyRef Runtime::any2PyObject (const Any &a ) const
}
case typelib_TypeClass_INTERFACE:
{
- Reference< XUnoTunnel > tunnel;
- a >>= tunnel;
- if( tunnel.is() )
+ // fdo#46678 must unlock GIL because getSomething could acquire locks,
+ // and queryInterface too...
{
- sal_Int64 that = tunnel->getSomething( ::pyuno::Adapter::getUnoTunnelImplementationId() );
- if( that )
- return ((Adapter*)sal::static_int_cast< sal_IntPtr >(that))->getWrappedObject();
+ PyThreadDetach d;
+
+ 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:
return PyRef( PyUNO_new (a, getImpl()->cargo->xInvocation), SAL_NO_ACQUIRE );