From 94fc67f38e1fc9d23eb97a1d17db403c047fa4be Mon Sep 17 00:00:00 2001 From: Miller Puckette <msp@ucsd.edu> Date: Wed, 4 Feb 2009 10:48:54 -0800 Subject: [PATCH] Bug fixes: gfxstub, "send" crash after making templates, pd~ sync problems --- extra/pd~/pd~.c | 15 +++++---------- src/g_template.c | 2 +- src/g_text.c | 3 ++- src/notes.txt | 3 +++ src/s_main.c | 7 +++++++ src/x_connective.c | 3 ++- src/x_gui.c | 3 +-- 7 files changed, 21 insertions(+), 15 deletions(-) diff --git a/extra/pd~/pd~.c b/extra/pd~/pd~.c index 3cf713feb..eba594c80 100644 --- a/extra/pd~/pd~.c +++ b/extra/pd~/pd~.c @@ -466,21 +466,16 @@ static void pd_tilde_tick(t_pd_tilde *x) static void pd_tilde_anything(t_pd_tilde *x, t_symbol *s, int argc, t_atom *argv) { - char msgbuf[MAXPDSTRING], *sp, *ep = msgbuf+MAXPDSTRING; + char msgbuf[MAXPDSTRING]; if (!x->x_outfd) return; - msgbuf[0] = 0; - strncpy(msgbuf, s->s_name, MAXPDSTRING); - msgbuf[MAXPDSTRING-1] = 0; - sp = msgbuf + strlen(msgbuf); + fprintf(x->x_outfd, "%s ", s->s_name); while (argc--) { - if (sp < ep-1) - sp[0] = ' ', sp[1] = 0, sp++; - atom_string(argv++, sp, ep-sp); - sp += strlen(sp); + atom_string(argv++, msgbuf, MAXPDSTRING); + fprintf(x->x_outfd, "%s ", msgbuf); } - fprintf(x->x_outfd, "%s;\n", msgbuf); + fprintf(x->x_outfd, ";\n"); } static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv) diff --git a/src/g_template.c b/src/g_template.c index 34541c06d..f216b1040 100644 --- a/src/g_template.c +++ b/src/g_template.c @@ -106,7 +106,7 @@ t_template *template_new(t_symbol *templatesym, int argc, t_atom *argv) bad: argc -= 2; argv += 2; } - if (templatesym->s_name) + if (*templatesym->s_name) { x->t_sym = templatesym; pd_bind(&x->t_pdobj, x->t_sym); diff --git a/src/g_text.c b/src/g_text.c index b8680e875..f927bf38c 100644 --- a/src/g_text.c +++ b/src/g_text.c @@ -131,6 +131,7 @@ static void canvas_objtext(t_glist *gl, int xpix, int ypix, int selected, canvas_unsetcurrent((t_canvas *)gl); } +extern int sys_noautopatch; /* utility routine to figure out where to put a new text box from menu and whether to connect to it automatically */ static void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, @@ -138,7 +139,7 @@ static void canvas_howputnew(t_canvas *x, int *connectp, int *xpixp, int *ypixp, { int xpix, ypix, indx = 0, nobj = 0, n2, x1, x2, y1, y2; int connectme = (x->gl_editor->e_selection && - !x->gl_editor->e_selection->sel_next); + !x->gl_editor->e_selection->sel_next && !sys_noautopatch); if (connectme) { t_gobj *g, *selected = x->gl_editor->e_selection->sel_what; diff --git a/src/notes.txt b/src/notes.txt index 369b7ffe2..c11ef4e83 100644 --- a/src/notes.txt +++ b/src/notes.txt @@ -1,3 +1,5 @@ +bug: go to ~/rep/rand, start pd, use open panel to open ../mark/mark.pd - crash + ---------------- dolist -------------------- test: @@ -14,6 +16,7 @@ mac: Gnome: why don't windows pop up when clicked on? problems: +pd~ "start" followed by messages gives race condition because of "fromgui" biz get rid of remaining -export-dynamic in makefiles saving as "x.pd" on mac writes to "x.pd.pd" (can't reproduce this.) find asdf$1 (e.g.) doesn't work diff --git a/src/s_main.c b/src/s_main.c index 8e9cb08dd..a246e38af 100644 --- a/src/s_main.c +++ b/src/s_main.c @@ -81,6 +81,7 @@ int sys_extraflags; char sys_extraflagsstring[MAXPDSTRING]; int sys_run_scheduler(const char *externalschedlibname, const char *sys_extraflagsstring); +int sys_noautopatch; /* temporary hack to defeat new 0.42 editing */ /* here the "-1" counts signify that the corresponding vector hasn't been specified in command line arguments; sys_set_audio_settings will detect it @@ -398,6 +399,7 @@ static char *(usagemessage[]) = { "-schedlib <file> -- plug in external scheduler\n", "-extraflags <s> -- string argument to send schedlib\n", "-batch -- run off-line as a batch process\n", +"-noautopatch -- defeat auto-patching new from selected objects\n", }; static void sys_parsedevlist(int *np, int *vecp, int max, char *str) @@ -832,6 +834,11 @@ int sys_argparse(int argc, char **argv) sys_printtostderr = sys_nogui = 1; argc--; argv++; } + else if (!strcmp(*argv, "-noautopatch")) + { + sys_noautopatch = 1; + argc--; argv++; + } #ifdef UNISTD else if (!strcmp(*argv, "-rt") || !strcmp(*argv, "-realtime")) { diff --git a/src/x_connective.c b/src/x_connective.c index 8687154ea..b9093f46b 100644 --- a/src/x_connective.c +++ b/src/x_connective.c @@ -1245,7 +1245,8 @@ static void makefilename_scanformat(t_makefilename *x) static void *makefilename_new(t_symbol *s) { t_makefilename *x = (t_makefilename *)pd_new(makefilename_class); - if (!s || !s->s_name) s = gensym("file.%d"); + if (!s || !*s->s_name) + s = gensym("file.%d"); outlet_new(&x->x_obj, &s_symbol); x->x_format = s; x->x_accept = A_NULL; diff --git a/src/x_gui.c b/src/x_gui.c index 7cc23d260..6ba58a7b1 100644 --- a/src/x_gui.c +++ b/src/x_gui.c @@ -158,8 +158,7 @@ static void gfxstub_free(t_gfxstub *x) static void gfxstub_setup(void) { - gfxstub_class = class_new(gensym("gfxstub"), (t_newmethod)gfxstub_new, - (t_method)gfxstub_free, + gfxstub_class = class_new(gensym("gfxstub"), 0, (t_method)gfxstub_free, sizeof(t_gfxstub), CLASS_PD, 0); class_addanything(gfxstub_class, gfxstub_anything); class_addmethod(gfxstub_class, (t_method)gfxstub_signoff, -- GitLab