[PyQt] Deadlock in QPyQmlObjectProxy::disconnectNotify

Phil Thompson phil at riverbankcomputing.com
Fri Mar 11 12:56:14 GMT 2016


On 10 Mar 2016, at 7:18 pm, Arjen Hiemstra <a.hiemstra at ultimaker.com> wrote:
> 
> Hi,
> 
> For some time now, we have run into a rather nasty deadlock when certain QML 
> UI items are destroyed. It took me a while to find a minimal example where it 
> happens but attached is some Python code that will deadlock on my machine 
> within a few seconds after starting it. The equivalent C++ code (also 
> attached) does not deadlock.
> 
> This happens on several machines, one of them running Arch using Qt 5.5.1,  
> PyQt 5.5.1 and Python 3.5.1. It also happens on Mac OSX using Python 3.4, PyQt 
> 5.4 and Qt 5.5.1 and Windows using the packages provided on the PyQt site.
> 
> The deadlock happens in the destructor of QPyQmlObjectProxy, which tries to 
> disconnect from a signal of an object that is being destroyed. The backtrace 
> is as follows:

...you mean in the destroyNotify() of QPyQmlObjectProxy.

This seems to be a timing issue rather than a logic issue. What I will probably do is just to remove the disconnectNotify() implementation on the assumption that, if the signal has been disconnected, then it's never going to be emitted. In any event I think the only time the signal will be disconnected is when the internal Qml sender is being destroyed.

Phil


More information about the PyQt mailing list