[PyQt] Disturbing evidence of garbage collection error

Adrian Buehlmann adrian at cadifra.com
Sat Apr 28 12:16:44 BST 2012


On 2012-04-27 13:53, Andrew Suffield wrote:
>         query = QtSql.QSqlQuery()
>         if not query.prepare('select %s from %s where %s' % (','.join(field_names), table, self.key_expr(table))):
> 
> I get 'RuntimeError: underlying C/C++ object has been deleted' on the
> second line, with low probability. Sometimes it just segfaults instead
> while inside the C++ function QSqlQuery::prepare. Either way, it
> happens about one time in 100,000, and when it segfaults, a different
> thread is in the garbage collector.
> 
> So, we've got one thread deciding that the local python variables of
> another are garbage and freeing them, while the victim thread is still
> in a function call. That implies the local variables are somehow not
> getting registered properly as being referenced.
> 
> I'll keep digging, but some ideas or pointers to relevant code would
> be handy - it's not immediately clear how sip interacts with GC.

http://www.riverbankcomputing.com/pipermail/pyqt/2011-August/030378.html
might be useful.


More information about the PyQt mailing list