Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8842
Modified Files:
Tag: desiredata
desire.c
Log Message:
cleanup; prevent crash when using some commands on zombies
Index: desire.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v
retrieving revision 1.1.2.217.2.207
retrieving revision 1.1.2.217.2.208
diff -C2 -d -r1.1.2.217.2.207 -r1.1.2.217.2.208
*** desire.c 13 Aug 2007 01:58:33 -0000 1.1.2.217.2.207
--- desire.c 13 Aug 2007 19:52:40 -0000 1.1.2.217.2.208
***************
*** 495,499 ****
x->ylabel = (t_symbol **)getbytes(0);
// only manage this canvas if it's not one of the 3 invisible builtin canvases
! /* if (hack) gobj_subscribe(x,manager); */
return x;
}
--- 495,499 ----
x->ylabel = (t_symbol **)getbytes(0);
// only manage this canvas if it's not one of the 3 invisible builtin canvases
! // if (hack) gobj_subscribe(x,manager);
return x;
}
***************
*** 529,536 ****
if (yloc < CANVAS_DEFCANVASYLOC) yloc = CANVAS_DEFCANVASYLOC;
if (xloc < 0) xloc = 0;
! x->x1 = 0;
! x->y1 = 0;
! x->x2 = 1;
! x->y2 = 1;
canvas_setbounds(x, xloc, yloc, xloc + width, yloc + height);
x->owner = owner;
--- 529,534 ----
if (yloc < CANVAS_DEFCANVASYLOC) yloc = CANVAS_DEFCANVASYLOC;
if (xloc < 0) xloc = 0;
! x->x1 = 0; x->y1 = 0;
! x->x2 = 1; x->y2 = 1;
canvas_setbounds(x, xloc, yloc, xloc + width, yloc + height);
x->owner = owner;
***************
*** 616,621 ****
}
- static void graph_vis(t_gobj *gr, int vis);
-
static void canvas_redraw(t_canvas *x) {
gobj_changed(x,0);
--- 614,617 ----
***************
*** 702,706 ****
canvas_wires_each(oc,t,x)
if ((t.from == text && t.outletp == outp) ||
! (t.to == text && t.inletp == inp))
obj_disconnect(t.from, t.outlet, t.to, t.inlet);
}
--- 698,702 ----
canvas_wires_each(oc,t,x)
if ((t.from == text && t.outletp == outp) ||
! (t.to == text && t.inletp == inp))
obj_disconnect(t.from, t.outlet, t.to, t.inlet);
}
***************
*** 714,726 ****
static void canvas_resortinlets(t_canvas *x);
static void canvas_resortoutlets(t_canvas *x);
-
static void canvas_push(t_canvas *x, t_floatarg f) {pd_pushsym(x);}
-
/* assuming that this only ever gets called on toplevel canvases (?) */
static void canvas_pop(t_canvas *x, t_floatarg fvis) {
! pd_popsym(x);
! x->loading = 0;
! canvas_resortinlets(x);
! canvas_resortoutlets(x);
if (fvis) canvas_vis(x, 1);
}
--- 710,717 ----
static void canvas_resortinlets(t_canvas *x);
static void canvas_resortoutlets(t_canvas *x);
static void canvas_push(t_canvas *x, t_floatarg f) {pd_pushsym(x);}
/* assuming that this only ever gets called on toplevel canvases (?) */
static void canvas_pop(t_canvas *x, t_floatarg fvis) {
! pd_popsym(x); x->loading = 0; canvas_resortinlets(x); canvas_resortoutlets(x);
if (fvis) canvas_vis(x, 1);
}
***************
*** 728,735 ****
extern "C" void canvas_popabstraction(t_canvas *x) {
pd_set_newest(x);
! pd_popsym(x);
! x->loading = 0;
! canvas_resortinlets(x);
! canvas_resortoutlets(x);
}
--- 719,723 ----
extern "C" void canvas_popabstraction(t_canvas *x) {
pd_set_newest(x);
! pd_popsym(x); x->loading = 0; canvas_resortinlets(x); canvas_resortoutlets(x);
}
***************
*** 913,921 ****
else sys_gui("pdtk_pd_dsp 1\n");
ugen_start();
! //timeval v0,v1;
! //gettimeofday(&v0,0);
canvases_each(x) canvas_dodsp(x,1,0);
! //gettimeofday(&v1,0);
! //printf("canvas_start_dsp took %ld us\n",(v1.tv_sec-v0.tv_sec)*1000000+(v1.tv_usec-v0.tv_usec));
canvas_dspstate = 1;
}
--- 901,907 ----
else sys_gui("pdtk_pd_dsp 1\n");
ugen_start();
! //timeval v0,v1; gettimeofday(&v0,0);
canvases_each(x) canvas_dodsp(x,1,0);
! //gettimeofday(&v1,0); printf("canvas_start_dsp took %ld us\n",(v1.tv_sec-v0.tv_sec)*1000000+(v1.tv_usec-v0.tv_usec));
canvas_dspstate = 1;
}
***************
*** 929,936 ****
}
! /* DSP can be suspended before, and resumed after, operations which
! might affect the DSP chain. For example, we suspend before loading and
! resume afterward, so that DSP doesn't get resorted for every DSP object
! int the patch. */
int canvas_suspend_dsp () {
int rval = canvas_dspstate;
--- 915,920 ----
}
! /* DSP can be suspended before, and resumed after, operations which might affect the DSP chain.
! For example, we suspend before loading and resume afterwards, so that DSP doesn't get resorted for every DSP object in the patch. */
int canvas_suspend_dsp () {
int rval = canvas_dspstate;
***************
*** 938,950 ****
return rval;
}
!
! void canvas_resume_dsp(int oldstate) {
! if (oldstate) canvas_start_dsp();
! }
!
/* this is equivalent to suspending and resuming in one step. */
! void canvas_update_dsp () {
! if (canvas_dspstate) canvas_start_dsp();
! }
extern "C" void glob_dsp(void *self, t_symbol *s, int argc, t_atom *argv) {
--- 922,928 ----
return rval;
}
! void canvas_resume_dsp(int oldstate) {if (oldstate) canvas_start_dsp();}
/* this is equivalent to suspending and resuming in one step. */
! void canvas_update_dsp () {if (canvas_dspstate) canvas_start_dsp();}
extern "C" void glob_dsp(void *self, t_symbol *s, int argc, t_atom *argv) {
***************
*** 961,966 ****
}
! extern "C"
! void *canvas_getblock(t_class *blockclass, t_canvas **canvasp) {
t_canvas *canvas = *canvasp;
void *ret = 0;
--- 939,943 ----
}
! extern "C" void *canvas_getblock(t_class *blockclass, t_canvas **canvasp) {
t_canvas *canvas = *canvasp;
void *ret = 0;
***************
*** 5598,5603 ****
t_text *o;
if (sscanf(s->name,"x%lx",(long*)&o)<1) {error("expected object-id"); return 0;}
! if (!object_table->exists(o) || !(long)object_table->get(o)&1) {
! error("%s target is not a currently valid pointer",s->name);
return 0;
}
--- 5575,5581 ----
t_text *o;
if (sscanf(s->name,"x%lx",(long*)&o)<1) {error("expected object-id"); return 0;}
! if (!object_table->exists(o)) {error("%s target is not a currently valid pointer",s->name); return 0;}
! if ((object_table->get(o)&1)==0) {
! error("%s target is zombie? object_table says '%ld'",s->name,object_table->get(o));
return 0;
}
***************
*** 5623,5626 ****
--- 5601,5605 ----
static void canvas_object_delete(t_canvas *x, t_symbol *name) {
t_text *o = symbol2opointer(name); if (!o) return;
+ fprintf(stderr,"canvas_object_delete %p\n",o);
canvas_delete(x,o);
gobj_changed(x,"children");
***************
*** 6411,6414 ****
--- 6390,6395 ----
if(max>0.0 && min<=0.0) min = 0.01*max;
if(max<=0.0 && min>0.0) max = 0.01*min;
+ } else {
+ if(min>max) swap(min,max);
}
SET(min,min);