Blob Blame History Raw
To: vim-dev@vim.org
Subject: Patch 7.1.165
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 7.1.165
Problem:    Crash related to getting X window ID. (Dominique Pelle)
Solution:   Don't trust the window ID that we got in the past, check it every
	    time.
Files:	    src/os_unix.c


*** ../vim-7.1.164/src/os_unix.c	Thu Aug 30 11:46:46 2007
--- src/os_unix.c	Thu Nov 29 18:19:56 2007
***************
*** 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.
***************
*** 1567,1584 ****
  #ifdef FEAT_XCLIPBOARD
      if (xterm_dpy != NULL && x11_window != 0)
      {
! 	/* Checked it already. */
! 	if (x11_display_from == XD_XTERM)
! 	    return OK;
! 
! 	/*
! 	 * If the X11 display was opened here before, for the window where Vim
! 	 * was started, close that one now to avoid a memory leak.
! 	 */
! 	if (x11_display_from == XD_HERE && x11_display != NULL)
! 	    XCloseDisplay(x11_display);
! 	x11_display = xterm_dpy;
! 	x11_display_from = XD_XTERM;
  	if (test_x11_window(x11_display) == FAIL)
  	{
  	    /* probably bad $WINDOWID */
--- 1567,1585 ----
  #ifdef FEAT_XCLIPBOARD
      if (xterm_dpy != NULL && x11_window != 0)
      {
! 	/* We may have checked it already, but Gnome terminal can move us to
! 	 * another window, so we need to check every time. */
! 	if (x11_display_from != XD_XTERM)
! 	{
! 	    /*
! 	     * If the X11 display was opened here before, for the window where
! 	     * Vim was started, close that one now to avoid a memory leak.
! 	     */
! 	    if (x11_display_from == XD_HERE && x11_display != NULL)
! 		XCloseDisplay(x11_display);
! 	    x11_display = xterm_dpy;
! 	    x11_display_from = XD_XTERM;
! 	}
  	if (test_x11_window(x11_display) == FAIL)
  	{
  	    /* probably bad $WINDOWID */
***************
*** 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
--- 2422,2428 ----
  /*
   * 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
  
--- 4654,4660 ----
  	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
  
--- 4802,4808 ----
  #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]);
--- 5192,5198 ----
  	{
  	    /* 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 */
--- 5676,5682 ----
  	    /* 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 */
*** ../vim-7.1.164/src/version.c	Thu Nov 29 21:26:38 2007
--- src/version.c	Sat Dec  1 17:17:20 2007
***************
*** 668,669 ****
--- 668,671 ----
  {   /* Add new patch number below this line */
+ /**/
+     165,
  /**/

-- 
"Hit any key to continue" is very confusing when you have two keyboards.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///