Commit fd3b76f8 authored by Jonathan Wilkes's avatar Jonathan Wilkes
Browse files

fix #289: invalid read with iemguis due to partially port of the new loadbang interface.

parent 74f43ce5
...@@ -390,9 +390,9 @@ static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av){bng_bang2(x);} ...@@ -390,9 +390,9 @@ static void bng_list(t_bng *x, t_symbol *s, int ac, t_atom *av){bng_bang2(x);}
static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv) static void bng_anything(t_bng *x, t_symbol *s, int argc, t_atom *argv)
{bng_bang2(x);} {bng_bang2(x);}
static void bng_loadbang(t_bng *x) static void bng_loadbang(t_bng *x, t_floatarg action)
{ {
if(!sys_noloadbang && x->x_gui.x_loadinit) if (action == LB_LOAD && x->x_gui.x_loadinit)
{ {
bng_set(x); bng_set(x);
bng_bout(x,0); bng_bout(x,0);
...@@ -528,7 +528,8 @@ void g_bang_setup(void) ...@@ -528,7 +528,8 @@ void g_bang_setup(void)
A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0); A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, A_FLOAT, 0);
class_addmethod(bng_class, (t_method)bng_dialog, gensym("dialog"), class_addmethod(bng_class, (t_method)bng_dialog, gensym("dialog"),
A_GIMME, 0); A_GIMME, 0);
class_addmethod(bng_class, (t_method)bng_loadbang, gensym("loadbang"), 0); class_addmethod(bng_class, (t_method)bng_loadbang, gensym("loadbang"),
A_DEFFLOAT, 0);
class_addmethod(bng_class, (t_method)bng_size, gensym("size"), A_GIMME, 0); class_addmethod(bng_class, (t_method)bng_size, gensym("size"), A_GIMME, 0);
iemgui_class_addmethods(bng_class); iemgui_class_addmethods(bng_class);
class_addmethod(bng_class, (t_method)bng_flashtime, gensym("flashtime"), class_addmethod(bng_class, (t_method)bng_flashtime, gensym("flashtime"),
......
...@@ -6116,7 +6116,7 @@ static t_canvas *paste_canvas; ...@@ -6116,7 +6116,7 @@ static t_canvas *paste_canvas;
static void glist_donewloadbangs(t_glist *x) static void glist_donewloadbangs(t_glist *x)
{ {
if (x->gl_editor) if (!sys_noloadbang && x->gl_editor)
{ {
t_selection *sel; t_selection *sel;
for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next)
......
...@@ -683,9 +683,9 @@ static void my_numbox_lin(t_my_numbox *x) ...@@ -683,9 +683,9 @@ static void my_numbox_lin(t_my_numbox *x)
x->x_lin0_log1 = 0; x->x_lin0_log1 = 0;
} }
static void my_numbox_loadbang(t_my_numbox *x) static void my_numbox_loadbang(t_my_numbox *x, t_floatarg action)
{ {
if(!sys_noloadbang && x->x_gui.x_loadinit) if (action == LB_LOAD && x->x_gui.x_loadinit)
{ {
sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update); sys_queuegui(x, x->x_gui.x_glist, my_numbox_draw_update);
my_numbox_bang(x); my_numbox_bang(x);
...@@ -858,7 +858,7 @@ void g_numbox_setup(void) ...@@ -858,7 +858,7 @@ void g_numbox_setup(void)
class_addmethod(my_numbox_class, (t_method)my_numbox_dialog, class_addmethod(my_numbox_class, (t_method)my_numbox_dialog,
gensym("dialog"), A_GIMME, 0); gensym("dialog"), A_GIMME, 0);
class_addmethod(my_numbox_class, (t_method)my_numbox_loadbang, class_addmethod(my_numbox_class, (t_method)my_numbox_loadbang,
gensym("loadbang"), 0); gensym("loadbang"), A_DEFFLOAT, 0);
class_addmethod(my_numbox_class, (t_method)my_numbox_set, class_addmethod(my_numbox_class, (t_method)my_numbox_set,
gensym("set"), A_FLOAT, 0); gensym("set"), A_FLOAT, 0);
class_addmethod(my_numbox_class, (t_method)my_numbox_size, class_addmethod(my_numbox_class, (t_method)my_numbox_size,
......
...@@ -419,9 +419,9 @@ static int radio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix, ...@@ -419,9 +419,9 @@ static int radio_newclick(t_gobj *z, struct _glist *glist, int xpix, int ypix,
return (1); return (1);
} }
static void radio_loadbang(t_radio *x) static void radio_loadbang(t_radio *x, t_floatarg action)
{ {
if(!sys_noloadbang && x->x_gui.x_loadinit) if(action == LB_LOAD && x->x_gui.x_loadinit)
{ {
radio_bang(x); radio_bang(x);
} }
...@@ -529,7 +529,8 @@ void radio_addmethods(t_class *c) ...@@ -529,7 +529,8 @@ void radio_addmethods(t_class *c)
{ {
class_addbang(c, radio_bang); class_addbang(c, radio_bang);
class_addfloat(c, radio_float); class_addfloat(c, radio_float);
class_addmethod(c, (t_method)radio_loadbang, gensym("loadbang"), 0); class_addmethod(c, (t_method)radio_loadbang, gensym("loadbang"),
A_DEFFLOAT, 0);
class_addmethod(c, (t_method)radio_set, gensym("set"), A_FLOAT, 0); class_addmethod(c, (t_method)radio_set, gensym("set"), A_FLOAT, 0);
class_addmethod(c, (t_method)radio_size, gensym("size"), A_GIMME, 0); class_addmethod(c, (t_method)radio_size, gensym("size"), A_GIMME, 0);
class_addmethod(c, (t_method)iemgui_init, gensym("init"), A_FLOAT, 0); class_addmethod(c, (t_method)iemgui_init, gensym("init"), A_FLOAT, 0);
......
...@@ -483,9 +483,9 @@ static void slider_steady(t_slider *x, t_floatarg f) ...@@ -483,9 +483,9 @@ static void slider_steady(t_slider *x, t_floatarg f)
x->x_steady = (f==0.0)?0:1; x->x_steady = (f==0.0)?0:1;
} }
static void slider_loadbang(t_slider *x) static void slider_loadbang(t_slider *x, t_floatarg action)
{ {
if(!sys_noloadbang && x->x_gui.x_loadinit) if(action == LB_LOAD && x->x_gui.x_loadinit)
{ {
x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE); x->x_gui.x_draw(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
slider_bang(x); slider_bang(x);
...@@ -597,7 +597,7 @@ static void slider_free(t_slider *x) ...@@ -597,7 +597,7 @@ static void slider_free(t_slider *x)
void slider_addmethods(t_class *c) { void slider_addmethods(t_class *c) {
class_addmethod(c, (t_method)slider_loadbang, class_addmethod(c, (t_method)slider_loadbang,
gensym("loadbang"), 0); gensym("loadbang"), A_DEFFLOAT, 0);
class_addmethod(c, (t_method)slider_set, class_addmethod(c, (t_method)slider_set,
gensym("set"), A_FLOAT, 0); gensym("set"), A_FLOAT, 0);
class_addmethod(c, (t_method)slider_log, gensym("log"), 0); class_addmethod(c, (t_method)slider_log, gensym("log"), 0);
......
...@@ -328,9 +328,9 @@ static void toggle_fout(t_toggle *x, t_floatarg f) ...@@ -328,9 +328,9 @@ static void toggle_fout(t_toggle *x, t_floatarg f)
iemgui_out_float(&x->x_gui, 0, 0, x->x_on); iemgui_out_float(&x->x_gui, 0, 0, x->x_on);
} }
static void toggle_loadbang(t_toggle *x) static void toggle_loadbang(t_toggle *x, t_floatarg action)
{ {
if(!sys_noloadbang && x->x_gui.x_loadinit) if (action == LB_LOAD && x->x_gui.x_loadinit)
toggle_fout(x, (t_float)x->x_on); toggle_fout(x, (t_float)x->x_on);
} }
...@@ -440,7 +440,7 @@ void g_toggle_setup(void) ...@@ -440,7 +440,7 @@ void g_toggle_setup(void)
class_addmethod(toggle_class, (t_method)toggle_dialog, gensym("dialog"), class_addmethod(toggle_class, (t_method)toggle_dialog, gensym("dialog"),
A_GIMME, 0); A_GIMME, 0);
class_addmethod(toggle_class, (t_method)toggle_loadbang, gensym("loadbang"), class_addmethod(toggle_class, (t_method)toggle_loadbang, gensym("loadbang"),
0); A_DEFFLOAT, 0);
class_addmethod(toggle_class, (t_method)toggle_set, gensym("set"), class_addmethod(toggle_class, (t_method)toggle_set, gensym("set"),
A_FLOAT, 0); A_FLOAT, 0);
class_addmethod(toggle_class, (t_method)toggle_size, gensym("size"), class_addmethod(toggle_class, (t_method)toggle_size, gensym("size"),
......
...@@ -1697,7 +1697,8 @@ t_pd *glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir) ...@@ -1697,7 +1697,8 @@ t_pd *glob_evalfile(t_pd *ignore, t_symbol *name, t_symbol *dir)
x = s__X.s_thing; x = s__X.s_thing;
vmess(x, gensym("pop"), "i", 1); vmess(x, gensym("pop"), "i", 1);
} }
pd_doloadbang(); if (!sys_noloadbang)
pd_doloadbang();
canvas_resume_dsp(dspstate); canvas_resume_dsp(dspstate);
s__X.s_thing = boundx; s__X.s_thing = boundx;
return x; return x;
......
...@@ -117,7 +117,7 @@ static void loadbang_click(t_loadbang *x, ...@@ -117,7 +117,7 @@ static void loadbang_click(t_loadbang *x,
static void loadbang_loadbang(t_loadbang *x, t_floatarg action) static void loadbang_loadbang(t_loadbang *x, t_floatarg action)
{ {
if (!sys_noloadbang && action == LB_LOAD) if (action == LB_LOAD)
outlet_bang(x->x_obj.ob_outlet); outlet_bang(x->x_obj.ob_outlet);
} }
......
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