Commit e19a3b31 authored by pokergaming's avatar pokergaming
Browse files

fixed bug that prevented scalars from redrawing correctly when a [group] was deleted

parent 82ec6b1d
......@@ -420,6 +420,7 @@ t_canvas *canvas_new(void *dummy, t_symbol *sel, int argc, t_atom *argv)
(canvas_newfilename ? canvas_newfilename : gensym("Pd")));
canvas_bind(x);
x->gl_loading = 1;
x->gl_unloading = 0;
//fprintf(stderr,"loading = 1 .x%lx owner=.x%lx\n", (t_int)x, (t_int)x->gl_owner);
x->gl_goprect = 0; /* no GOP rectangle unless it's turned on later */
/* cancel "vis" flag if we're a subpatch of an
......@@ -882,6 +883,7 @@ void canvas_free(t_canvas *x)
if (canvas_whichfind == x)
canvas_whichfind = 0;
glist_noselect(x);
x->gl_unloading = 1;
while (y = x->gl_list)
glist_delete(x, y);
if (x == glist_getcanvas(x))
......
......@@ -206,6 +206,7 @@ struct _glist
unsigned int gl_willvis:1; /* make me visible after loading */
unsigned int gl_edit:1; /* edit mode */
unsigned int gl_isdeleting:1; /* we're inside glist_delete -- hack! */
unsigned int gl_unloading:1; /* we're inside canvas_free */
unsigned int gl_goprect:1; /* draw rectangle for graph-on-parent */
unsigned int gl_isgraph:1; /* show as graph on parent */
unsigned int gl_hidetext:1; /* hide object-name + args when doing graph on parent */
......
......@@ -161,6 +161,13 @@ void glist_delete(t_glist *x, t_gobj *y)
{
/* JMZ: send a closebang to the canvas */
canvas_closebang((t_canvas *)y);
/* and this little hack so drawing commands can tell
if a [group] is deleting them (and thus suppress
their own redraws) */
((t_canvas *)y)->gl_unloading = 1;
/* if we are a group, let's call ourselves a drawcommand */
if (((t_canvas *)y)->gl_svg)
drawcommand = 1;
}
wasdeleting = canvas_setdeleting(canvas, 1);
......@@ -202,7 +209,7 @@ void glist_delete(t_glist *x, t_gobj *y)
if (drawcommand)
{
tmpl = template_findbydrawcommand(y);
if (!(canvas_isgroup(canvas) && canvas->gl_isdeleting))
if (!(canvas_isgroup(canvas) && canvas->gl_unloading))
{
canvas_redrawallfortemplate(tmpl, 2);
}
......@@ -238,8 +245,10 @@ void glist_delete(t_glist *x, t_gobj *y)
if (chkdsp) canvas_update_dsp();
if (drawcommand)
{
if (!(canvas_isgroup(canvas) && canvas->gl_isdeleting))
if (!(canvas_isgroup(canvas) && canvas->gl_unloading))
{
canvas_redrawallfortemplate(tmpl, 1);
}
}
canvas_setdeleting(canvas, wasdeleting);
x->gl_valid = ++glist_valid;
......
......@@ -7442,6 +7442,8 @@ t_template *template_findbydrawcommand(t_gobj *g)
c = ((t_drawimage *)g)->x_canvas;
else if (g->g_pd == plot_class)
c = ((t_plot *)g)->x_canvas;
else if (g->g_pd == canvas_class)
c = (t_canvas *)g;
else return (0);
c = canvas_templatecanvas_forgroup(c);
t_symbol *s1 = gensym("struct");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment