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

2006-09-19 Thread David Boddie
On Tuesday 19 September 2006 08:36:31 +0100 (BST), Phil Thompson wrote: Allen Bierbaum wrote: > > 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 orig

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

2006-09-19 Thread Phil Thompson
> 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 successful

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

2006-09-18 Thread Allen Bierbaum
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

Re: [PyKDE] Model indexes and internal pointers

2006-08-19 Thread Arve Knudsen
On 8/19/06, Hans-Peter Jansen <[EMAIL PROTECTED]> wrote: Nope, it's your call to find the right tree to bark up.. Well, I'm not going to pursue this issue any further. I have enough on my agenda for the time being. Arve ___ PyKDE mailing listPyK

Re: [PyKDE] Model indexes and internal pointers

2006-08-19 Thread Hans-Peter Jansen
Am Samstag, 19. August 2006 01:39 schrieb Arve Knudsen: > On 8/17/06, Phil Thompson <[EMAIL PROTECTED]> wrote: > > Having looked at this yet again it's clear that it's not possible > > to implement this without leaking Python references. I don't know > > why I thought it was possible at one stage.

Re: [PyKDE] Model indexes and internal pointers

2006-08-18 Thread Arve Knudsen
On 8/17/06, Phil Thompson <[EMAIL PROTECTED]> wrote: Having looked at this yet again it's clear that it's not possible to implement this without leaking Python references. I don't know why I thought it was possible at one stage. The obvious problems are the lack of virtual dtor (so there is no p

Re: [PyKDE] Model indexes and internal pointers

2006-08-17 Thread Phil Thompson
Having looked at this yet again it's clear that it's not possible to implement this without leaking Python references. I don't know why I thought it was possible at one stage. The obvious problems are the lack of virtual dtor (so there is no place to reliably decrement the reference count) and

Re: [PyKDE] Model indexes and internal pointers

2006-07-26 Thread Arve Knudsen
Appreciated. Arve On 7/26/06, Phil Thompson <[EMAIL PROTECTED]> wrote: On Wednesday 26 July 2006 9:05 am, Arve Knudsen wrote: > Phil, did you reach any conclusion on this? I think model/view > programming is so integral to Qt 4 programming it should warrant some > extra attention in a Python la

Re: [PyKDE] Model indexes and internal pointers

2006-07-26 Thread Phil Thompson
On Wednesday 26 July 2006 9:05 am, Arve Knudsen wrote: > Phil, did you reach any conclusion on this? I think model/view > programming is so integral to Qt 4 programming it should warrant some > extra attention in a Python layer. I'm inclined to agree with you, particularly as it seems reasonably e

Re: [PyKDE] Model indexes and internal pointers

2006-07-26 Thread Arve Knudsen
Phil, did you reach any conclusion on this? I think model/view programming is so integral to Qt 4 programming it should warrant some extra attention in a Python layer. Arve On 7/18/06, Phil Thompson <[EMAIL PROTECTED]> wrote: On Monday 17 July 2006 10:09 pm, Arve Knudsen wrote: > On 7/17/06, An

Re: [PyKDE] Model indexes and internal pointers

2006-07-19 Thread David Boddie
On Wednesday 19 July 2006 10:52, Jeremy Sanders wrote: > On Wed, 19 Jul 2006, David Boddie wrote: > > > Probably, but there's not much you can do if you attach Python objects > > to temporary C++ objects and pass them back to Qt. If you just prevent > > them from being collected, there's the chanc

Re: [PyKDE] Model indexes and internal pointers

2006-07-19 Thread Jeremy Sanders
On Wed, 19 Jul 2006, David Boddie wrote: Probably, but there's not much you can do if you attach Python objects to temporary C++ objects and pass them back to Qt. If you just prevent them from being collected, there's the chance that they'll become unrecoverable. Maybe the handling of QPersisten

Re: [PyKDE] Model indexes and internal pointers

2006-07-18 Thread Arve Knudsen
Andreas' explanation sounds correct to me, it's obvious that one should be able to access data stored with an index created in the index() method when it is later passed to methods such as data(). What happened in my case was that I created indexes in index() with references to Python objects tha

Re: [PyKDE] Model indexes and internal pointers

2006-07-18 Thread Andreas Pakulat
On 19.07.06 00:53:42, David Boddie wrote: > On Tue, 18 Jul 2006 10:35:17 +0200, Arve Knudsen wrote: > > When you say that model indexes are temporary, do you mean that if one > > keeps a reference to a wrapping Python object, the underlying C++ > > object may still get destroyed? That doesn't apply

Re: [PyKDE] Model indexes and internal pointers

2006-07-18 Thread David Boddie
On Tue, 18 Jul 2006 10:35:17 +0200, Arve Knudsen wrote: > When you say that model indexes are temporary, do you mean that if one > keeps a reference to a wrapping Python object, the underlying C++ > object may still get destroyed? That doesn't apply to my case at > least, I only need to access ind

Re: [PyKDE] Model indexes and internal pointers

2006-07-18 Thread Arve Knudsen
On 7/18/06, David Boddie <[EMAIL PROTECTED]> wrote: On Tue Jul 18 00:23:47 MEST 2006, Phil Thompson wrote: > There are plenty of other places where you have to keep an external > reference to stop an object being garbage collected causing a crash. I just > need to decide if this is worth making a

Re: [PyKDE] Model indexes and internal pointers

2006-07-17 Thread David Boddie
On Tue Jul 18 00:23:47 MEST 2006, Phil Thompson wrote: > On Monday 17 July 2006 10:09 pm, Arve Knudsen wrote: > > On 7/17/06, Andreas Pakulat wrote: > > > On 17.07.06 22:00:41, Arve Knudsen wrote: > > > > Ok, I found the original thread. There is no explanation as to why no > > > > extra reference

Re: [PyKDE] Model indexes and internal pointers

2006-07-17 Thread Phil Thompson
On Monday 17 July 2006 10:09 pm, Arve Knudsen wrote: > On 7/17/06, Andreas Pakulat <[EMAIL PROTECTED]> wrote: > > On 17.07.06 22:00:41, Arve Knudsen wrote: > > > Ok, I found the original thread. There is no explanation as to why no > > > extra reference is kept however. > > > > I don't know too muc

Re: [PyKDE] Model indexes and internal pointers

2006-07-17 Thread Arve Knudsen
On 7/17/06, Andreas Pakulat <[EMAIL PROTECTED]> wrote: On 17.07.06 22:00:41, Arve Knudsen wrote: > Ok, I found the original thread. There is no explanation as to why no > extra reference is kept however. I don't know too much about python refcounting, but I think one problem could be what to do

Re: [PyKDE] Model indexes and internal pointers

2006-07-17 Thread Andreas Pakulat
On 17.07.06 22:00:41, Arve Knudsen wrote: > Ok, I found the original thread. There is no explanation as to why no > extra reference is kept however. I don't know too much about python refcounting, but I think one problem could be what to do if the model index disappears. Also decrease the referenc

Re: [PyKDE] Model indexes and internal pointers

2006-07-17 Thread Arve Knudsen
Ok, I found the original thread. There is no explanation as to why no extra reference is kept however. There might be a good reason for this behaviour, but it does represent a rather nasty pitfall. Arve On 7/17/06, Andreas Pakulat <[EMAIL PROTECTED]> wrote: On 16.07.06 12:34:34, Arve Knudsen wr

Re: [PyKDE] Model indexes and internal pointers

2006-07-17 Thread Andreas Pakulat
On 16.07.06 12:34:34, Arve Knudsen wrote: > Phil: Might it be an idea to make QModelIndex update the reference > count for its "internalPointer"? This is only a suggestion on my part, > as I'm in not an expert on Python/C++ interfacing. I just resolved > some mysterious segfaults in an application

[PyKDE] Model indexes and internal pointers

2006-07-16 Thread Arve Knudsen
Phil: Might it be an idea to make QModelIndex update the reference count for its "internalPointer"? This is only a suggestion on my part, as I'm in not an expert on Python/C++ interfacing. I just resolved some mysterious segfaults in an application of mine to a temporary Python object being stored