[PyQt] Crash with sip 4.19.8

Phil Thompson phil at riverbankcomputing.com
Tue Mar 20 09:33:36 GMT 2018


On 20 Mar 2018, at 7:08 am, Boudewijn Rempt <boud at valdyas.org> wrote:
> 
> On maandag 19 maart 2018 18:49:13 CET Phil Thompson wrote:
>> On 19 Mar 2018, at 12:37 pm, Boudewijn Rempt <boud at valdyas.org> wrote:
>>> Hi,
>>> 
>>> I'm not sure how to isolate or investigate this. I got this bug report:
>>> 
>>> https://bugs.kde.org/show_bug.cgi?id=391992
>>> 
>>> Which reports a crash that happens with sip 4.19.8, but not with 4.19.7.
>>> I'm not sure what changed between the two versions either...
>> 
>> There was only one change which was related to crashes with highly threaded
>> applications. The change itself is relatively small.
> 
> Hm, and this is just something that happens on shutting down the application. 
> A singleton gets destructed and deletes the plugins it had loaded.

When Python creates an instance of a wrapped class it creates a Python object and a C++ instance that have pointers to each other. sip will null those pointers if it detects that the "thing" that is being pointed to no longer exists.

The bug was that, under certain circumstances, the pointer in the C++ instance to the Python object was not being nulled when the Python object was garbage collected. This would be a particular problem if the C++ instance was itself being destroyed and its dtor was calling virtual functions. I would look at the C++ dtor code of the singleton to see if it is doing anything "naughty".

Phil


More information about the PyQt mailing list