Bugs item #1359216, was opened at 2005-11-17 14:14 Message generated for change (Comment added) made by matju You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1359216...
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: puredata Group: None Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: print character 123 freezes gui
Initial Comment: On WinXP and Miller's pd039_test7 typing '{' (ascii 123) after print in an object box hangs the gui, apparently because the tcl is waiting for a closing '}' before proceeding.
In the source code, dopost() in s_print.c, it looks like four characters are escaped: '', '{', '}', and ';'. But if they are escaped they should not freeze the gui...
static void dopost(const char *s) { ... if (c == '' || c == '{' || c == '}' || c == ';') <- if it's a dangerous character for tcl upbuf[ptout++] = ''; <- add a backslash before the dangerous character upbuf[ptout] = s[ptin]; <- then put the character ... sys_vgui("pdtk_post {%s}\n", upbuf); <- then send it to tcl interpreter
If I try entering them in a print box I get different results. '' and '}' are rejected: }: dropped : dropped ';' is accepted '{' freezes the gui.
In g_editor.c:
void canvas_key(t_canvas *x, t_symbol *s, int ac, t_atom *av) {
... if (keynum == '' || keynum == '{' || keynum == '}') <-a dangerous character { post("%c: dropped", (int)keynum); <-should be dropped, but for '{' this doesn't get printed return; } ...dopost() is called from post() so '{' is causing trouble even when it is escaped with a backslash.
Submitted by Martin Peach martinrp@vax2.condordia.ca
----------------------------------------------------------------------
Comment By: Mathieu Bouchard (matju) Date: 2005-12-03 01:57
Message: Logged In: YES user_id=801174
fixed in DesireData today.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=478070&aid=1359216...
On Sat, 3 Dec 2005, Thomas Grill wrote:
fixed in DesireData today.
Hi Mathieu, since DesireData is not actually usable, could you post a patch or outline what the solution looks like so that it can be fixed in PD?
char t[MAXPDSTRING]; int i,j=0; for(i=0; s[i] && j<MAXPDSTRING-16; i++) { if (index("\"[]$\n",s[i])) t[j++]='\'; t[j++] = s[i]=='\n' ? 'n' : s[i]; } t[j] = 0; sys_vgui("pdtk_post "%s"\n",t);
____________________________________________________________________ Mathieu Bouchard - tél:+1.514.383.3801 - http://artengine.ca/matju Freelance Digital Arts Engineer, Montréal QC Canada
On Dec 3, 2005, at 3:08 AM, Mathieu Bouchard wrote:
On Sat, 3 Dec 2005, Thomas Grill wrote:
fixed in DesireData today.
Hi Mathieu, since DesireData is not actually usable, could you post a patch or outline what the solution looks like so that it can be fixed in PD?
char t[MAXPDSTRING]; int i,j=0; for(i=0; s[i] && j<MAXPDSTRING-16; i++) { if (index("\\\"[]$\n",s[i])) t[j++]='\\'; t[j++] = s[i]=='\n' ? 'n' : s[i]; } t[j] = 0; sys_vgui("pdtk_post \"%s\"\n",t);
Any chance of getting this as a diff -uw against pd MAIN?
.hc
________________________________________________________________________ ____
"The arc of history bends towards justice." - Dr. Martin Luther King, Jr.
Am 04.12.2005 um 17:27 schrieb Hans-Christoph Steiner:
On Dec 3, 2005, at 3:08 AM, Mathieu Bouchard wrote:
On Sat, 3 Dec 2005, Thomas Grill wrote:
fixed in DesireData today.
Hi Mathieu, since DesireData is not actually usable, could you post a patch or outline what the solution looks like so that it can be fixed in PD?
char t[MAXPDSTRING]; int i,j=0; for(i=0; s[i] && j<MAXPDSTRING-16; i++) { if (index("\\\"[]$\n",s[i])) t[j++]='\\'; t[j++] = s[i]=='\n' ? 'n' : s[i]; } t[j] = 0; sys_vgui("pdtk_post \"%s\"\n",t);
Any chance of getting this as a diff -uw against pd MAIN?
no diff, but the function dopost in s_print.c would be
static void dopost(const char *s) { if (sys_printhook) (*sys_printhook)(s); else if (sys_printtostderr) fprintf(stderr, "%s", s); else { char upbuf[MAXPDSTRING]; int i,j=0; for(i=0; s[i] && j<MAXPDSTRING-16; i++) { if (strchr("\"[]$\n",s[i])) upbuf[j++]='\'; if (s[i]=='\n') upbuf[j++]='n'; else upbuf[j++] = s[i]; } upbuf[j] = 0;
sys_vgui("pdtk_post "%s"\n", upbuf); } }
(corrected to be more portable and respect PD coding style)
Anyway, it doesn't work - PD still freezes when i type { inside an object window ("{: dropped" can't be printed)
best, Thomas