[PyQt] Deadlock in QPyQmlObjectProxy::disconnectNotify

Arjen Hiemstra a.hiemstra at ultimaker.com
Sat Mar 12 20:15:04 GMT 2016


On 11 March 2016 at 13:56, Phil Thompson <phil at riverbankcomputing.com> wrote:
> 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.

Yes indeed, sorry about that.

>
> 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.

Is this something I could patch locally to help test it? Just remove
the implementation of disconnectNotify in qpyqmlobject.cpp ?

>
> Phil


More information about the PyQt mailing list