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

Hans-Christoph Steiner hans at at.or.at
Wed Jul 14 19:17:41 CEST 2010


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





More information about the Pd-dev mailing list