[PyQt] Disturbing evidence of garbage collection error

Phil Thompson phil at riverbankcomputing.com
Sun Apr 29 15:51:43 BST 2012


On Sat, 28 Apr 2012 12:14:14 +0100, Andrew Suffield
<asuffield at suffields.me.uk> wrote:
> On Sat, Apr 28, 2012 at 01:05:37PM +0200, Erik Janssens wrote:
>> which version of PyQt are you using ?
>> 
>> When in older versions (I think something like 2 releases ago),
>> the garbage collection kicks in in a thread and it deletes
>> a QObject from another thread, this object was deleted
>> immediately, while in recent versions those are deleted later
>> on in the event loop of the thread to which they belong.
> 
> This is on 4.9.1, but that's a different sort of bug. This is
> happening while query.prepare is executing - there's no way that query
> should be considered garbage and get collected at this point. The bug
> is not that it's being collecting improperly, but rather that it's
> being collected at all while still in use.

You might try keeping explicit references to any objects involved in the
query where you might be expecting PyQt to keep the reference for you.

Phil


More information about the PyQt mailing list