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

fix a crasher with uninitialized canvas field abstraction names

parent 39823ac8
......@@ -258,7 +258,7 @@ typedef struct _dataslot
int ds_type;
t_symbol *ds_name;
t_symbol *ds_fieldtemplate; /* filled in for arrays only */
t_symbol *ds_fieldtemplate; /* filled in only for array/canvas fields */
t_binbuf *ds_binbuf; /* binbuf of an abstraction to be loaded */
} t_dataslot;
......@@ -787,8 +787,10 @@ static void canvas_savetemplatesto(t_canvas *x, t_binbuf *b, int wholething)
case DT_TEXT: type = gensym("text"); break; //&s_list; break;
default: type = &s_float; bug("canvas_write");
if (template->t_vec[j].ds_type == DT_ARRAY ||
template->t_vec[j].ds_type == DT_LIST)
if (template->t_vec[j].ds_type == DT_LIST)
binbuf_addv(b, "sss", type, template->t_vec[j].ds_name,
else if (template->t_vec[j].ds_type == DT_ARRAY)
binbuf_addv(b, "sss", type, template->t_vec[j].ds_name,
gensym(template->t_vec[j].ds_fieldtemplate->s_name + 3));
else binbuf_addv(b, "ss", type, template->t_vec[j].ds_name);
......@@ -96,8 +96,9 @@ t_template *template_new(t_symbol *templatesym, int argc, t_atom *argv)
pd_error(x, "canvas lacks template or name");
goto bad;
/* If we keep the canvas field API this needs to be revisited */
//filename = canvas_makebindsym(argv[2].a_w.w_symbol);
/* We're abusing newarraytemplate here to store the name of
the abstraction (minus the .pd extension) */
newarraytemplate = argv[2].a_w.w_symbol;
sprintf(filename, "%s.pd", argv[2].a_w.w_symbol->s_name);
if (binbuf_read_via_canvas(b, filename, canvas_getcurrent(), 0))
post("warning: abstraction %s not found", filename);
Supports Markdown
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