[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] QCanvasSprite and QPixmapArray scope issues
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2006-04-28 14:01:58
Message-ID: 200604281501.58396.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Friday 28 April 2006 2:27 pm, Alexander Borghgraef wrote:
> On 4/28/06, Phil Thompson <phil@riverbankcomputing.co.uk> wrote:
> > QCanvasSprite does not take responsibility for calling the QPixmapArray
> > dtor,
> > ie. it doesn't take ownership of the QPixmapArray instance.  Therefore,
> > when
> > the latter goes out of scope it is garbage collected (unless there is
> > another
> > reference to it). Your solution is the conventional way of handling it.
> >
> > Python isn't C++.
>
> I gathered that :-) Ok, but how about QCanvas? Apparently, the canvas
> *does* take ownership of
> any item put on it, even though its situation is similar to that of
> QCanvasSprite. Or does it just seem
> that way, and am I taking horrible risks with the example in my previous
> post which for some odd
> reason haven't blown up in my face yet?

Yes, QCanvas takes ownership of QCanvasItems so you don't need to keep a 
reference yourself to prevent them from being garbage collected.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic