Hi - I've hit several crashes with Qt's model code with PyQt.
Can someone clear up the ownership rules for objects given to
QAbstractItemModel.createIndex and accessed with
QModelIndex.internalPointer?
I tried creating a layer of indirection when using createIndex, e.g.
class Indirect(object):
def __init__(self, realobj):
self.realobj = realobj
...
self.createIndex(row, col, Indirect(realobj))
This breaks rather horribly. The objects returned by internalPointer can be
completely random (the model index is however valid), with a different type.
Is because PyQt uses some sort of python id, which is reallocated by python
because the Indirector has no references to it?
I suppose I will have to hack something like storing a reference to the
Indirect object in the realobj.
Jeremy
--
http://www.jeremysanders.net/
_______________________________________________
PyQt mailing list [email protected]
http://www.riverbankcomputing.com/mailman/listinfo/pyqt