To: vim-dev@vim.org Subject: Patch 6.0ax.013 Fcc: outbox From: Bram Moolenaar ------------ Patch 6.0ax.013 Problem: remote_foreground() could use an invalid third argument. Evaluating an expression with a command line argument could cause a hang. A property change event was lost. Solution: Fix remote_foreground(). Check every second if a response has been received. (Flemming Madsen) Files: src/eval.c, src/if_xcmdsrv.c *** ../vim60ax.12/src/eval.c Thu Sep 13 15:36:05 2001 --- src/eval.c Mon Sep 24 11:56:31 2001 *************** *** 5724,5729 **** --- 5724,5730 ---- VAR argvars; VAR retvar; { + retvar->var_val.var_number = 0; #ifdef FEAT_CLIENTSERVER # ifdef WIN32 /* On Win32 it's done in this application. */ *************** *** 5732,5737 **** --- 5733,5739 ---- /* Send a foreground() expression to the server. */ argvars[1].var_type = VAR_STRING; argvars[1].var_val.var_string = vim_strsave((char_u *)"foreground()"); + argvars[2].var_type = VAR_UNKNOWN; remote_common(argvars, retvar, TRUE); vim_free(argvars[1].var_val.var_string); # endif *** ../vim60ax.12/src/if_xcmdsrv.c Sat Sep 15 14:42:14 2001 --- src/if_xcmdsrv.c Mon Sep 24 12:02:29 2001 *************** *** 552,557 **** --- 552,562 ---- lastChk = now; if (!WindowValid(dpy, w)) break; + /* + * Sometimes the PropertyChange event doesn't come. + * This can be seen in eg: vim -c 'echo remote_expr("gvim", "3+2")' + */ + serverEventProc(dpy, NULL); } if (localLoop) { *************** *** 1086,1094 **** long_u numItems, bytesAfter; Atom actualType; ! if (eventPtr->xproperty.atom != commProperty ! || eventPtr->xproperty.state != PropertyNewValue) ! return; /* * Read the comm property and delete it. --- 1091,1102 ---- long_u numItems, bytesAfter; Atom actualType; ! if (eventPtr != NULL) ! { ! if (eventPtr->xproperty.atom != commProperty ! || eventPtr->xproperty.state != PropertyNewValue) ! return; ! } /* * Read the comm property and delete it. *** ../vim60ax.12/src/version.c Sun Sep 23 21:43:41 2001 --- src/version.c Mon Sep 24 12:09:34 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 13, /**/ -- A M00se once bit my sister ... "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///