Commit b0a1f0bb authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

*fixed stderr errors where subpatch canvases were still trying to delete themselves

parent fccac0c8
......@@ -849,7 +849,7 @@ void glist_menu_open(t_glist *x)
int glist_isvisible(t_glist *x)
{
return ((!x->gl_loading) && glist_getcanvas(x)->gl_mapped);
return ((!x->gl_loading) && ((x->gl_isgraph && glist_getcanvas(x)->gl_mapped) || (!x->gl_isgraph && x->gl_mapped)));
}
int glist_istoplevel(t_glist *x)
......@@ -872,6 +872,7 @@ extern void canvas_group_free(t_pd *x);
void canvas_free(t_canvas *x)
{
//fprintf(stderr,"canvas_free %lx\n", (t_int)x);
t_gobj *y;
int dspstate = canvas_suspend_dsp();
......@@ -888,8 +889,8 @@ void canvas_free(t_canvas *x)
glist_delete(x, y);
if (x == glist_getcanvas(x))
canvas_vis(x, 0);
if (x->gl_editor)
canvas_destroy_editor(x); /* bug workaround; should already be gone*/
if (x->gl_editor)
canvas_destroy_editor(x); /* bug workaround; should already be gone*/
if (x-> x_handle) scalehandle_free( x->x_handle);
if (x->x_mhandle) scalehandle_free(x->x_mhandle);
......
......@@ -143,7 +143,7 @@ extern t_rtext *glist_tryfindrtext(t_glist *gl, t_text *who);
/* delete an object from a glist and free it */
void glist_delete(t_glist *x, t_gobj *y)
{
//fprintf(stderr,"glist_delete?\n");
//fprintf(stderr,"glist_delete y=%lx x=%lx glist_getcanvas=%lx\n", y, x, glist_getcanvas(x));
if (x->gl_list)
{
//fprintf(stderr,"glist_delete YES\n");
......@@ -184,22 +184,25 @@ void glist_delete(t_glist *x, t_gobj *y)
zap the inlets and outlets here... */
if (pd_class(&y->g_pd) == canvas_class)
{
t_glist *gl = (t_glist *)y;
if (gl->gl_isgraph)
if (glist_isvisible(x))
{
char tag[80];
//sprintf(tag, "graph%lx", (t_int)gl);
//t_glist *yy = (t_glist *)y;
sprintf(tag, "%s",
rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
glist_eraseiofor(x, &gl->gl_obj, tag);
text_eraseborder(&gl->gl_obj, x,
rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
}
else
{
text_eraseborder(&gl->gl_obj, x,
rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
t_glist *gl = (t_glist *)y;
if (gl->gl_isgraph)
{
char tag[80];
//sprintf(tag, "graph%lx", (t_int)gl);
//t_glist *yy = (t_glist *)y;
sprintf(tag, "%s",
rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
glist_eraseiofor(x, &gl->gl_obj, tag);
text_eraseborder(&gl->gl_obj, x,
rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
}
else
{
text_eraseborder(&gl->gl_obj, x,
rtext_gettag(glist_findrtext(x, &gl->gl_obj)));
}
}
}
}
......@@ -215,7 +218,10 @@ void glist_delete(t_glist *x, t_gobj *y)
}
}
if (glist_isvisible(canvas))
{
//fprintf(stderr,"...deleting %lx %lx\n", x, glist_getcanvas(x));
gobj_vis(y, x, 0);
}
if (x->gl_editor && (ob = pd_checkobject(&y->g_pd)))
{
//rtext_new(x, ob);
......@@ -314,6 +320,9 @@ t_canvas *glist_getcanvas(t_glist *x)
while (x->gl_owner && !x->gl_havewindow && x->gl_isgraph &&
gobj_shouldvis(&x->gl_gobj, x->gl_owner))
{
//fprintf(stderr,"x=%lx x->gl_owner=%d x->gl_havewindow=%d x->gl_isgraph=%d gobj_shouldvis=%d\n",
// x, (x->gl_owner ? 1:0), x->gl_havewindow, x->gl_isgraph,
// gobj_shouldvis(&x->gl_gobj, x->gl_owner));
x = x->gl_owner;
//fprintf(stderr,"+\n");
}
......
......@@ -1618,7 +1618,7 @@ static void text_vis(t_gobj *z, t_glist *glist, int vis)
t_rtext *y = glist_findrtext(glist, x);
if (gobj_shouldvis(&x->te_g, glist))
{
//fprintf(stderr," erase it\n");
//fprintf(stderr," erase it %lx %lx\n", x, glist);
text_eraseborder(x, glist, rtext_gettag(y));
rtext_erase(y);
}
......@@ -2194,7 +2194,8 @@ void glist_eraseiofor(t_glist *glist, t_object *ob, char *tag)
void text_eraseborder(t_text *x, t_glist *glist, char *tag)
{
//if (x->te_type == T_TEXT) return;
if (x->te_type == T_TEXT && !glist->gl_edit) return;
//if (!glist_isvisible(glist)) return;
sys_vgui(".x%lx.c delete %sR\n",
glist_getcanvas(glist), tag);
glist_eraseiofor(glist, x, tag);
......
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