Commit 1210898c authored by Ivica Bukvic's avatar Ivica Bukvic
Browse files

proper fix for the crash when closing one of the many concurrently open root patches

parent 20f48bb3
......@@ -884,6 +884,7 @@ void canvas_free(t_canvas *x)
if (x->gl_magic_glass) {
//magicGlass_free(x->gl_magic_glass);
pd_free(&x->gl_magic_glass->x_obj.te_g.g_pd);
x->gl_magic_glass = NULL;
}
//canvas_noundo(x);
......@@ -911,11 +912,11 @@ void canvas_free(t_canvas *x)
freebytes(x->gl_env->ce_argv, x->gl_env->ce_argc * sizeof(t_atom));
freebytes(x->gl_env, sizeof(*x->gl_env));
}
canvas_resume_dsp(dspstate);
glist_cleanup(x);
gfxstub_deleteforkey(x); /* probably unnecessary */
if (!x->gl_owner)
canvas_takeofflist(x);
canvas_resume_dsp(dspstate);
}
/* ----------------- lines ---------- */
......@@ -1376,8 +1377,8 @@ static void canvas_dodsp(t_canvas *x, int toplevel, t_signal **sp)
/* find all the "dsp" boxes and add them to the graph */
ob = &x->gl_magic_glass->x_obj;
if (ob && x->gl_magic_glass->x_connectedObj) {
//fprintf(stderr,"adding cord inspector to dsp\n");
if (ob && magicGlass_bound(x->gl_magic_glass)) {
//fprintf(stderr,"adding cord inspector to dsp %d\n", magicGlass_bound(x->gl_magic_glass));
ugen_add(dc, ob); // this t_canvas could be an array, hence no gl_magic_glass
}
......
......@@ -18,7 +18,7 @@ void magicGlass_clearText(t_magicGlass *x);
void magicGlass_bind(t_magicGlass *x, t_object *obj, int outno)
{
//fprintf(stderr,"magicglass_bind\n");
//fprintf(stderr,"magicglass_bind %lx\n", (t_int)x);
if (x->x_connectedObj != obj)
{
if (x->x_connectedObj)
......@@ -38,7 +38,7 @@ void magicGlass_bind(t_magicGlass *x, t_object *obj, int outno)
void magicGlass_unbind(t_magicGlass *x)
{
//fprintf(stderr,"magicglass_unbind\n");
//fprintf(stderr,"magicglass_unbind %lx\n", (t_int)x);
if (x->x_connectedObj)
{
obj_disconnect(x->x_connectedObj,
......@@ -285,7 +285,7 @@ void magicGlass_moveText(t_magicGlass *x, int pX, int pY)
int magicGlass_bound(t_magicGlass *x)
{
//fprintf(stderr,"magicglass_bound\n");
if (x->x_connectedObj)
if (x->x_connectedObj != NULL)
return 1;
else
return 0;
......@@ -378,7 +378,7 @@ void *magicGlass_new(t_glist *c)
{
//fprintf(stderr,"magicglass_new\n");
t_magicGlass *x = (t_magicGlass *)pd_new(magicGlass_class);
x->x_connectedObj= NULL;
x->x_connectedObj = NULL;
x->x_connectedOutno = 0;
x->x_visible = 0;
x->x_c = c;
......@@ -397,7 +397,7 @@ void *magicGlass_new(t_glist *c)
void magicGlass_free(t_magicGlass *x)
{
//fprintf(stderr,"magicglass_free\n");
//fprintf(stderr,"magicglass_free %lx\n", (t_int)x);
magicGlass_unbind(x);
x->x_dspOn = 0;
clock_free(x->x_clearClock);
......
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