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