I glanced at vim bugs opened in Ubuntu launchpad.  I found there a
crashing bug which I could reproduce with latest vim-7.1.156.

Steps to reproduce bug:
- use GNOME terminal
- open 2 tabs in GNOME terminal (File -> Open Tab)
- start vim in one of the tabs
- detach the GNOME terminal tab where vim is running (Tabs -> Detach Tabs)
- in vim, type <CTRL>-Z to suspend vim (goes into the shell)
- type fg in shell, to go back to vim
- observe that vim crashes with following error message:

BadWindow (invalid Window parameter)
Vim: Got X error
Vim: preserving files...
Vim: Finished.

Error happens when trying to set the terminal title.

More information at:
https://bugs.launchpad.net/ubuntu/+source/vim/+bug/129106

I found a way to fix it, but I do not know the code and X Window
enough to say whether it's the correct/best way to fix it.  Please
review it.  In any case, vim no longer crashes with the attached
patch.

It's a one line fix (add call to test_x11_window(x11_display))

Patch also contain fixes for typos in comments.

-- Dominique

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Index: os_unix.c
===================================================================
RCS file: /cvsroot/vim/vim7/src/os_unix.c,v
retrieving revision 1.73
diff -c -r1.73 os_unix.c
*** os_unix.c	30 Aug 2007 09:47:13 -0000	1.73
--- os_unix.c	18 Nov 2007 12:03:57 -0000
***************
*** 310,316 ****
  }
  
  /*
!  * mch_inchar(): low level input funcion.
   * Get a characters from the keyboard.
   * Return the number of characters that are available.
   * If wtime == 0 do not wait for characters.
--- 310,316 ----
  }
  
  /*
!  * mch_inchar(): low level input function.
   * Get a characters from the keyboard.
   * Return the number of characters that are available.
   * If wtime == 0 do not wait for characters.
***************
*** 1695,1701 ****
      int			retval = FALSE;
      Status		status;
  
!     if (get_x11_windis() == OK)
      {
  	/* Get window/icon name if any */
  	if (get_title)
--- 1695,1701 ----
      int			retval = FALSE;
      Status		status;
  
!     if (get_x11_windis() == OK && test_x11_window(x11_display) == OK)
      {
  	/* Get window/icon name if any */
  	if (get_title)
***************
*** 2421,2427 ****
  /*
   * Set the case of the file name, if it already exists.  This will cause the
   * file name to remain exactly the same.
!  * Only required for file systems where case is ingored and preserved.
   */
  /*ARGSUSED*/
      void
--- 2421,2427 ----
  /*
   * Set the case of the file name, if it already exists.  This will cause the
   * file name to remain exactly the same.
!  * Only required for file systems where case is ignored and preserved.
   */
  /*ARGSUSED*/
      void
***************
*** 4653,4659 ****
  	ret = poll(fds, nfd, towait);
  # ifdef FEAT_MZSCHEME
  	if (ret == 0 && mzquantum_used)
! 	    /* MzThreads scheduling is required and timeout occured */
  	    finished = FALSE;
  # endif
  
--- 4653,4659 ----
  	ret = poll(fds, nfd, towait);
  # ifdef FEAT_MZSCHEME
  	if (ret == 0 && mzquantum_used)
! 	    /* MzThreads scheduling is required and timeout occurred */
  	    finished = FALSE;
  # endif
  
***************
*** 4801,4807 ****
  #endif
  # ifdef FEAT_MZSCHEME
  	if (ret == 0 && mzquantum_used)
! 	    /* loop if MzThreads must be scheduled and timeout occured */
  	    finished = FALSE;
  # endif
  
--- 4801,4807 ----
  #endif
  # ifdef FEAT_MZSCHEME
  	if (ret == 0 && mzquantum_used)
! 	    /* loop if MzThreads must be scheduled and timeout occurred */
  	    finished = FALSE;
  # endif
  
***************
*** 5191,5197 ****
  	{
  	    /* When using system() always add extra quotes, because the shell
  	     * is started twice.  Otherwise put a backslash before special
! 	     * characters, except insice ``. */
  #ifdef USE_SYSTEM
  	    STRCAT(command, " \"");
  	    STRCAT(command, pat[i]);
--- 5191,5197 ----
  	{
  	    /* When using system() always add extra quotes, because the shell
  	     * is started twice.  Otherwise put a backslash before special
! 	     * characters, except inside ``. */
  #ifdef USE_SYSTEM
  	    STRCAT(command, " \"");
  	    STRCAT(command, pat[i]);
***************
*** 5675,5681 ****
  	    /* gpm library tries to handling TSTP causes
  	     * problems. Anyways, we close connection to Gpm whenever
  	     * we are going to suspend or starting an external process
! 	     * so we should'nt  have problem with this
  	     */
  	    signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
  	    return 1; /* succeed */
--- 5675,5681 ----
  	    /* gpm library tries to handling TSTP causes
  	     * problems. Anyways, we close connection to Gpm whenever
  	     * we are going to suspend or starting an external process
! 	     * so we shouldn't have problem with this
  	     */
  	    signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
  	    return 1; /* succeed */

Raspunde prin e-mail lui