adff5a9
To: vim-dev@vim.org
adff5a9
Subject: Patch 7.1.165
adff5a9
Fcc: outbox
adff5a9
From: Bram Moolenaar <Bram@moolenaar.net>
adff5a9
Mime-Version: 1.0
adff5a9
Content-Type: text/plain; charset=ISO-8859-1
adff5a9
Content-Transfer-Encoding: 8bit
adff5a9
------------
adff5a9
adff5a9
Patch 7.1.165
adff5a9
Problem:    Crash related to getting X window ID. (Dominique Pelle)
adff5a9
Solution:   Don't trust the window ID that we got in the past, check it every
adff5a9
	    time.
adff5a9
Files:	    src/os_unix.c
adff5a9
adff5a9
adff5a9
*** ../vim-7.1.164/src/os_unix.c	Thu Aug 30 11:46:46 2007
adff5a9
--- src/os_unix.c	Thu Nov 29 18:19:56 2007
adff5a9
***************
adff5a9
*** 310,316 ****
adff5a9
  }
adff5a9
  
adff5a9
  /*
adff5a9
!  * mch_inchar(): low level input funcion.
adff5a9
   * Get a characters from the keyboard.
adff5a9
   * Return the number of characters that are available.
adff5a9
   * If wtime == 0 do not wait for characters.
adff5a9
--- 310,316 ----
adff5a9
  }
adff5a9
  
adff5a9
  /*
adff5a9
!  * mch_inchar(): low level input function.
adff5a9
   * Get a characters from the keyboard.
adff5a9
   * Return the number of characters that are available.
adff5a9
   * If wtime == 0 do not wait for characters.
adff5a9
***************
adff5a9
*** 1567,1584 ****
adff5a9
  #ifdef FEAT_XCLIPBOARD
adff5a9
      if (xterm_dpy != NULL && x11_window != 0)
adff5a9
      {
adff5a9
! 	/* Checked it already. */
adff5a9
! 	if (x11_display_from == XD_XTERM)
adff5a9
! 	    return OK;
adff5a9
! 
adff5a9
! 	/*
adff5a9
! 	 * If the X11 display was opened here before, for the window where Vim
adff5a9
! 	 * was started, close that one now to avoid a memory leak.
adff5a9
! 	 */
adff5a9
! 	if (x11_display_from == XD_HERE && x11_display != NULL)
adff5a9
! 	    XCloseDisplay(x11_display);
adff5a9
! 	x11_display = xterm_dpy;
adff5a9
! 	x11_display_from = XD_XTERM;
adff5a9
  	if (test_x11_window(x11_display) == FAIL)
adff5a9
  	{
adff5a9
  	    /* probably bad $WINDOWID */
adff5a9
--- 1567,1585 ----
adff5a9
  #ifdef FEAT_XCLIPBOARD
adff5a9
      if (xterm_dpy != NULL && x11_window != 0)
adff5a9
      {
adff5a9
! 	/* We may have checked it already, but Gnome terminal can move us to
adff5a9
! 	 * another window, so we need to check every time. */
adff5a9
! 	if (x11_display_from != XD_XTERM)
adff5a9
! 	{
adff5a9
! 	    /*
adff5a9
! 	     * If the X11 display was opened here before, for the window where
adff5a9
! 	     * Vim was started, close that one now to avoid a memory leak.
adff5a9
! 	     */
adff5a9
! 	    if (x11_display_from == XD_HERE && x11_display != NULL)
adff5a9
! 		XCloseDisplay(x11_display);
adff5a9
! 	    x11_display = xterm_dpy;
adff5a9
! 	    x11_display_from = XD_XTERM;
adff5a9
! 	}
adff5a9
  	if (test_x11_window(x11_display) == FAIL)
adff5a9
  	{
adff5a9
  	    /* probably bad $WINDOWID */
adff5a9
***************
adff5a9
*** 2421,2427 ****
adff5a9
  /*
adff5a9
   * Set the case of the file name, if it already exists.  This will cause the
adff5a9
   * file name to remain exactly the same.
adff5a9
!  * Only required for file systems where case is ingored and preserved.
adff5a9
   */
adff5a9
  /*ARGSUSED*/
adff5a9
      void
adff5a9
--- 2422,2428 ----
adff5a9
  /*
adff5a9
   * Set the case of the file name, if it already exists.  This will cause the
adff5a9
   * file name to remain exactly the same.
adff5a9
!  * Only required for file systems where case is ignored and preserved.
adff5a9
   */
adff5a9
  /*ARGSUSED*/
adff5a9
      void
adff5a9
***************
adff5a9
*** 4653,4659 ****
adff5a9
  	ret = poll(fds, nfd, towait);
adff5a9
  # ifdef FEAT_MZSCHEME
adff5a9
  	if (ret == 0 && mzquantum_used)
adff5a9
! 	    /* MzThreads scheduling is required and timeout occured */
adff5a9
  	    finished = FALSE;
adff5a9
  # endif
adff5a9
  
adff5a9
--- 4654,4660 ----
adff5a9
  	ret = poll(fds, nfd, towait);
adff5a9
  # ifdef FEAT_MZSCHEME
adff5a9
  	if (ret == 0 && mzquantum_used)
adff5a9
! 	    /* MzThreads scheduling is required and timeout occurred */
adff5a9
  	    finished = FALSE;
adff5a9
  # endif
adff5a9
  
adff5a9
***************
adff5a9
*** 4801,4807 ****
adff5a9
  #endif
adff5a9
  # ifdef FEAT_MZSCHEME
adff5a9
  	if (ret == 0 && mzquantum_used)
adff5a9
! 	    /* loop if MzThreads must be scheduled and timeout occured */
adff5a9
  	    finished = FALSE;
adff5a9
  # endif
adff5a9
  
adff5a9
--- 4802,4808 ----
adff5a9
  #endif
adff5a9
  # ifdef FEAT_MZSCHEME
adff5a9
  	if (ret == 0 && mzquantum_used)
adff5a9
! 	    /* loop if MzThreads must be scheduled and timeout occurred */
adff5a9
  	    finished = FALSE;
adff5a9
  # endif
adff5a9
  
adff5a9
***************
adff5a9
*** 5191,5197 ****
adff5a9
  	{
adff5a9
  	    /* When using system() always add extra quotes, because the shell
adff5a9
  	     * is started twice.  Otherwise put a backslash before special
adff5a9
! 	     * characters, except insice ``. */
adff5a9
  #ifdef USE_SYSTEM
adff5a9
  	    STRCAT(command, " \"");
adff5a9
  	    STRCAT(command, pat[i]);
adff5a9
--- 5192,5198 ----
adff5a9
  	{
adff5a9
  	    /* When using system() always add extra quotes, because the shell
adff5a9
  	     * is started twice.  Otherwise put a backslash before special
adff5a9
! 	     * characters, except inside ``. */
adff5a9
  #ifdef USE_SYSTEM
adff5a9
  	    STRCAT(command, " \"");
adff5a9
  	    STRCAT(command, pat[i]);
adff5a9
***************
adff5a9
*** 5675,5681 ****
adff5a9
  	    /* gpm library tries to handling TSTP causes
adff5a9
  	     * problems. Anyways, we close connection to Gpm whenever
adff5a9
  	     * we are going to suspend or starting an external process
adff5a9
! 	     * so we should'nt  have problem with this
adff5a9
  	     */
adff5a9
  	    signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
adff5a9
  	    return 1; /* succeed */
adff5a9
--- 5676,5682 ----
adff5a9
  	    /* gpm library tries to handling TSTP causes
adff5a9
  	     * problems. Anyways, we close connection to Gpm whenever
adff5a9
  	     * we are going to suspend or starting an external process
adff5a9
! 	     * so we shouldn't  have problem with this
adff5a9
  	     */
adff5a9
  	    signal(SIGTSTP, restricted ? SIG_IGN : SIG_DFL);
adff5a9
  	    return 1; /* succeed */
adff5a9
*** ../vim-7.1.164/src/version.c	Thu Nov 29 21:26:38 2007
adff5a9
--- src/version.c	Sat Dec  1 17:17:20 2007
adff5a9
***************
adff5a9
*** 668,669 ****
adff5a9
--- 668,671 ----
adff5a9
  {   /* Add new patch number below this line */
adff5a9
+ /**/
adff5a9
+     165,
adff5a9
  /**/
adff5a9
adff5a9
-- 
adff5a9
"Hit any key to continue" is very confusing when you have two keyboards.
adff5a9
adff5a9
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
adff5a9
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
adff5a9
\\\        download, build and distribute -- http://www.A-A-P.org        ///
adff5a9
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///