To: vim-dev@vim.org Subject: patch 5.4.6 Fcc: outbox From: Bram Moolenaar ------------ I got one confirmation that this fixes the problem, and noone said it caused new problems, thus I'll change the exprimental patch into an official one. Patch 5.4.6 Problem: GTK GUI: Using ":gui" in the .gvimrc file caused an error. Only happens when the GUI forks. Solution: Don't fork in a recursive call of gui_start(). Files: src/gui.c *** ../vim-5.4/src/gui.c Sun Jul 25 22:02:00 1999 --- src/gui.c Thu Jul 29 10:40:21 1999 *************** *** 32,49 **** /* * gui_start -- Called when user wants to start the GUI. */ void gui_start() { ! char_u *old_term; #if defined(UNIX) && !defined(__BEOS__) ! pid_t pid = -1; ! int dofork = TRUE; #endif #ifdef USE_GUI_GTK int pfd[2]; #endif old_term = vim_strsave(T_NAME); --- 32,54 ---- /* * gui_start -- Called when user wants to start the GUI. + * + * Careful: This function can be called recursively when there is a ":gui" + * command in the .gvimrc file. Only the first call should fork, not the + * recursive call. */ void gui_start() { ! char_u *old_term; #if defined(UNIX) && !defined(__BEOS__) ! pid_t pid = -1; ! int dofork = TRUE; #endif #ifdef USE_GUI_GTK int pfd[2]; #endif + static int recursive = 0; old_term = vim_strsave(T_NAME); *************** *** 64,72 **** full_screen = FALSE; #if defined(UNIX) && !defined(__BEOS__) ! if (!gui.dofork || vim_strchr(p_go, GO_FORG)) dofork = FALSE; #endif #ifdef USE_GUI_GTK /* --- 69,78 ---- full_screen = FALSE; #if defined(UNIX) && !defined(__BEOS__) ! if (!gui.dofork || vim_strchr(p_go, GO_FORG) || recursive) dofork = FALSE; #endif + ++recursive; #ifdef USE_GUI_GTK /* *************** *** 96,102 **** { (void)close(pfd[0]); /* child closes its read end */ termcapinit((char_u *)"builtin_gui"); /* goes to gui_init() */ ! gui.starting = FALSE; (void)write(pfd[1], &gui.in_use, sizeof(int)); (void)close(pfd[1]); if (!gui.in_use) --- 102,108 ---- { (void)close(pfd[0]); /* child closes its read end */ termcapinit((char_u *)"builtin_gui"); /* goes to gui_init() */ ! gui.starting = recursive - 1; (void)write(pfd[1], &gui.in_use, sizeof(int)); (void)close(pfd[1]); if (!gui.in_use) *************** *** 110,115 **** --- 116,122 ---- #ifdef AUTOCMD apply_autocmds(EVENT_GUIENTER, NULL, NULL, FALSE, curbuf); #endif + --recursive; return; /* child successfully started gui */ } else /* parent */ *************** *** 134,140 **** { termcapinit((char_u *)"builtin_gui"); ! gui.starting = FALSE; } --- 141,147 ---- { termcapinit((char_u *)"builtin_gui"); ! gui.starting = recursive - 1; } *************** *** 181,186 **** --- 188,194 ---- if (gui.in_use) apply_autocmds(EVENT_GUIENTER, NULL, NULL, FALSE, curbuf); #endif + --recursive; } /* *** ../vim-5.4/src/version.h Thu Jul 29 11:48:02 1999 --- src/version.h Thu Jul 29 11:48:26 1999 *************** *** 19,26 **** #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 5 ! #define VIM_VERSION_PATCHLEVEL_STR "5" /* * VIM_VERSION_NODOT is used for the runtime directory name. --- 19,26 ---- #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 6 ! #define VIM_VERSION_PATCHLEVEL_STR "6" /* * VIM_VERSION_NODOT is used for the runtime directory name. *************** *** 30,35 **** */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.5" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.5 (1999 Jul 29)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.5 (1999 Jul 29, compiled " --- 30,35 ---- */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.6" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.6 (1999 Jul 29)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.6 (1999 Jul 29, compiled " -- CUSTOMER: Well, can you hang around a couple of minutes? He won't be long. MORTICIAN: Naaah, I got to go on to Robinson's -- they've lost nine today. CUSTOMER: Well, when is your next round? MORTICIAN: Thursday. DEAD PERSON: I think I'll go for a walk. The Quest for the Holy Grail (Monty Python) --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /