[PD-dev] canvas_* functions and using glist_getcanvas()

Miller Puckette mpuckett at imusic1.ucsd.edu
Wed Jul 14 21:15:35 CEST 2010


I think glist_getcanvas() is only appropriate when getting or changing
properties that are inherited from the containing canvas (whether visible
or not, for example) -- and many canvas_whatever(canvas, object) or
glist_whatever(canvas, object) calls assume tha the oject is indeed in that
glist itself (glist is synonym for canvas) and will crash if not.

cheers
Miller

On Wed, Jul 14, 2010 at 01:17:41PM -0400, Hans-Christoph Steiner wrote:
> 
> I've noticed that in GUI objects, its quite common to call the  
> canvas_* functions using glist_getcanvas().  I also just found out  
> that this causes a crash in [envgen] when this is done for  
> canvas_deletelinesfor().  See bug:
> 
> http://sourceforge.net/tracker/index.php?func=detail&aid=2842897&group_id=55736&atid=478070
> 
> So it seems to me that glist_getcanvas() should not be called on the  
> glist before sending it to one of these canvas functions.  I was  
> wondering if this is kind of a blanket rule, and we should be removing  
> the glist_getcanvas() calls in GUI objects.  For example:
> 
> unauthorized/cooled~/cooled~.c:     
> canvas_deletelinesfor( glist_getcanvas(glist), (t_text *)z);
> unauthorized/cooled~/cooled~.c:     
> canvas_fixlinesfor( glist_getcanvas( x->x_glist ), (t_text*)x );
> 
> In ggee/gui/w_envgen.h, I fixed the crasher by replacing:
> 
>     canvas_deletelinesfor(glist_getcanvas(glist), x);
> 
> with this:
> 
>     canvas_deletelinesfor(glist, x);
> 
> .hc
> 
> ----------------------------------------------------------------------------
> 
> "Free software means you control what your computer does. Non-free  
> software means someone else controls that, and to some extent controls  
> you." - Richard M. Stallman
> 
> 
> 
> _______________________________________________
> Pd-dev mailing list
> Pd-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev



More information about the Pd-dev mailing list