Karsten Hopp 96eb03
To: vim_dev@googlegroups.com
Karsten Hopp 96eb03
Subject: Patch 7.3.765
Karsten Hopp 96eb03
Fcc: outbox
Karsten Hopp 96eb03
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 96eb03
Mime-Version: 1.0
Karsten Hopp 96eb03
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 96eb03
Content-Transfer-Encoding: 8bit
Karsten Hopp 96eb03
------------
Karsten Hopp 96eb03
Karsten Hopp 96eb03
Patch 7.3.765
Karsten Hopp 96eb03
Problem:    Segfault when doing "cclose" on BufUnload in a python function.
Karsten Hopp 96eb03
	    (Sean Reifschneider)
Karsten Hopp 96eb03
Solution:   Skip window with NULL buffer. (Christian Brabandt)
Karsten Hopp 96eb03
Files:	    src/main.c, src/window.c
Karsten Hopp 96eb03
Karsten Hopp 96eb03
Karsten Hopp 96eb03
*** ../vim-7.3.764/src/main.c	2012-11-28 15:55:37.000000000 +0100
Karsten Hopp 96eb03
--- src/main.c	2013-01-17 13:46:57.000000000 +0100
Karsten Hopp 96eb03
***************
Karsten Hopp 96eb03
*** 1376,1381 ****
Karsten Hopp 96eb03
--- 1376,1384 ----
Karsten Hopp 96eb03
  	    for (wp = (tp == curtab)
Karsten Hopp 96eb03
  		    ? firstwin : tp->tp_firstwin; wp != NULL; wp = wp->w_next)
Karsten Hopp 96eb03
  	    {
Karsten Hopp 96eb03
+ 		if (wp->w_buffer == NULL)
Karsten Hopp 96eb03
+ 		    /* Autocmd must have close the buffer already, skip. */
Karsten Hopp 96eb03
+ 		    continue;
Karsten Hopp 96eb03
  		buf = wp->w_buffer;
Karsten Hopp 96eb03
  		if (buf->b_changedtick != -1)
Karsten Hopp 96eb03
  		{
Karsten Hopp 96eb03
*** ../vim-7.3.764/src/window.c	2012-08-29 15:50:22.000000000 +0200
Karsten Hopp 96eb03
--- src/window.c	2013-01-17 13:53:10.000000000 +0100
Karsten Hopp 96eb03
***************
Karsten Hopp 96eb03
*** 2276,2284 ****
Karsten Hopp 96eb03
  #endif
Karsten Hopp 96eb03
      }
Karsten Hopp 96eb03
  
Karsten Hopp 96eb03
      /* Autocommands may have closed the window already, or closed the only
Karsten Hopp 96eb03
       * other window or moved to another tab page. */
Karsten Hopp 96eb03
!     if (!win_valid(win) || last_window() || curtab != prev_curtab
Karsten Hopp 96eb03
  	    || close_last_window_tabpage(win, free_buf, prev_curtab))
Karsten Hopp 96eb03
  	return;
Karsten Hopp 96eb03
  
Karsten Hopp 96eb03
--- 2276,2290 ----
Karsten Hopp 96eb03
  #endif
Karsten Hopp 96eb03
      }
Karsten Hopp 96eb03
  
Karsten Hopp 96eb03
+     if (only_one_window() && win_valid(win) && win->w_buffer == NULL
Karsten Hopp 96eb03
+ 	    && (last_window() || curtab != prev_curtab
Karsten Hopp 96eb03
+ 		|| close_last_window_tabpage(win, free_buf, prev_curtab)))
Karsten Hopp 96eb03
+ 	/* Autocommands have close all windows, quit now. */
Karsten Hopp 96eb03
+ 	getout(0);
Karsten Hopp 96eb03
+ 
Karsten Hopp 96eb03
      /* Autocommands may have closed the window already, or closed the only
Karsten Hopp 96eb03
       * other window or moved to another tab page. */
Karsten Hopp 96eb03
!     else if (!win_valid(win) || last_window() || curtab != prev_curtab
Karsten Hopp 96eb03
  	    || close_last_window_tabpage(win, free_buf, prev_curtab))
Karsten Hopp 96eb03
  	return;
Karsten Hopp 96eb03
  
Karsten Hopp 96eb03
***************
Karsten Hopp 96eb03
*** 6282,6288 ****
Karsten Hopp 96eb03
  	return FALSE;
Karsten Hopp 96eb03
  
Karsten Hopp 96eb03
      for (wp = firstwin; wp != NULL; wp = wp->w_next)
Karsten Hopp 96eb03
! 	if ((!((wp->w_buffer->b_help && !curbuf->b_help)
Karsten Hopp 96eb03
  # ifdef FEAT_QUICKFIX
Karsten Hopp 96eb03
  		    || wp->w_p_pvw
Karsten Hopp 96eb03
  # endif
Karsten Hopp 96eb03
--- 6288,6295 ----
Karsten Hopp 96eb03
  	return FALSE;
Karsten Hopp 96eb03
  
Karsten Hopp 96eb03
      for (wp = firstwin; wp != NULL; wp = wp->w_next)
Karsten Hopp 96eb03
! 	if (wp->w_buffer != NULL
Karsten Hopp 96eb03
! 		&& (!((wp->w_buffer->b_help && !curbuf->b_help)
Karsten Hopp 96eb03
  # ifdef FEAT_QUICKFIX
Karsten Hopp 96eb03
  		    || wp->w_p_pvw
Karsten Hopp 96eb03
  # endif
Karsten Hopp 96eb03
*** ../vim-7.3.764/src/version.c	2013-01-17 13:35:13.000000000 +0100
Karsten Hopp 96eb03
--- src/version.c	2013-01-17 13:56:56.000000000 +0100
Karsten Hopp 96eb03
***************
Karsten Hopp 96eb03
*** 727,728 ****
Karsten Hopp 96eb03
--- 727,730 ----
Karsten Hopp 96eb03
  {   /* Add new patch number below this line */
Karsten Hopp 96eb03
+ /**/
Karsten Hopp 96eb03
+     765,
Karsten Hopp 96eb03
  /**/
Karsten Hopp 96eb03
Karsten Hopp 96eb03
-- 
Karsten Hopp 96eb03
       He was not in the least bit scared to be mashed into a pulp
Karsten Hopp 96eb03
       Or to have his eyes gouged out and his elbows broken;
Karsten Hopp 96eb03
       To have his kneecaps split and his body burned away
Karsten Hopp 96eb03
       And his limbs all hacked and mangled, brave Sir Robin.
Karsten Hopp 96eb03
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
Karsten Hopp 96eb03
Karsten Hopp 96eb03
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 96eb03
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 96eb03
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 96eb03
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///