Internal Pointers again... Was: [PyKDE] Model indexes and internal pointers

Phil Thompson phil at riverbankcomputing.co.uk
Tue Sep 19 08:36:31 BST 2006


> Phil et al:
>
> How much of a lost cause is this?  I ask because I just got bit by
> this bug and ate up nearly a day trying to track down a very nasty seg
> fault.   As Arve said in the original thread, Model-View programming
> is a core of QT and this issue makes it very difficult to successfully
> program this type of system.  I think it is especially relevant to
> PyQT because it is very common to have temporary python wrappers
> hanging around when interfacing with C++ code.
>
> In my case I have wrappers around a scene graph (a tree structure for
> computer graphics).  Anytime I call through to C++ and ask the tree
> nodes for children or parents, I get a python wrapper back.  This
> wrapper is referencing a ref-counted class on the C++ side, but it is
> unique as far as python is concerned.  So when I put this into
> internalPointer to retrieve later it immediately goes out of scope in
> python and is invalid when I try to reference it later.
>
> If there is any way to make this work I think it would greatly improve
> PyQT.

It isn't technically possible - unless somebody has a bright idea.

Phil




More information about the PyQt mailing list