[PyKDE] QItemSelectionModel disappearing from under derived class

Rich Pickler rpickler at laika.com
Fri Feb 23 19:12:49 GMT 2007


I have a class derived from a QItemSelectionModel in order to simplify
some behaviors when new selections are made in order to get those
changes to other selection models.  Unfortunately, the
QItemSelectionModel is deleted out from under my derived class, causing
my program to crash with one of two errors depending on the how I re-
arrange the code.

1) Fatal Python error: GC object already tracked
2) RuntimeError: underlying C/C++ object has been deleted

Any ideas?

In trying to diagnose this problem, I've tried out a number of things,
with results I did not expect:

* I monitored the connectNotify and the disconnectNotify functions from
my derived class, and they are never called.  Looking at the qt source,
there are two signals that are connected and disconnected every time
setSelectionModel is called.
* If I over-ride setSelectionModel in my widget, the function gets a
pointer to a QItemSelectionModel, not my derived class.

This is all with PyQt 4.0.1, Sip 4.4.5, and QT 4.1.4.

Rich




More information about the PyQt mailing list