<div dir="ltr"><br>Does the QAbstractModelIndex.createIndex() function increment the reference count for python objects passed into the internal pointer parameter? It appears that it does not. If it does not, is it supposed to? I'm trying to implement a tree model for data contained in a MySQL database. The data can change in the background at any time and children of root elements can and frequently are children of multiple root items. This makes it very hard to determine the parent item from a child QModelIndex without duplicating all the data from the db. (Or at least I'm finding it very difficult) So what I was doing was putting a tuple into the internal pointer parameter. The tuple contained a reference to the parent object, the parent object row (used to determine if data has been added or removed from the database) and a reference to the child node. But when the getNodeFromIndex routine gets called, the tuple that was assigned to the ptr has been garbage collected and I get a NotImplementedType and generally a crash with an error such as:<br>
<br>*** glibc detected *** python: double free or corruption (fasttop): 0x08619a78 ***<br><br>Does anyone have any ideas? If people feel that the reference counter should be incremented, I can look at patching the source, but I'm not sure that's the right thing.<br>
<br>Thanks in advance.<br clear="all"><br>-- <br>Doug Nichols<br><a href="mailto:doug16@gmail.com">doug16@gmail.com</a><br><a href="http://dnwnichols.home.comcast.net/">http://dnwnichols.home.comcast.net/</a><br>
</div>