To: [email protected]
Subject: Patch 7.4a.044
Fcc: outbox
From: Bram Moolenaar <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4a.044
Problem:    Test 96 sometimes fails.
Solution:   Clear window from b_wininfo in win_free().  (Suggestion by
           Yukihiro Nakadaira)
Files:      src/window.c


*** ../vim-7.4a.043/src/window.c        2013-07-24 16:02:32.000000000 +0200
--- src/window.c        2013-07-24 17:38:29.000000000 +0200
***************
*** 4518,4524 ****
 #if defined(FEAT_WINDOWS) || defined(PROTO)

 /*
!  * remove window 'wp' from the window list and free the structure
  */
     static void
 win_free(wp, tp)
--- 4518,4524 ----
 #if defined(FEAT_WINDOWS) || defined(PROTO)

 /*
!  * Remove window 'wp' from the window list and free the structure.
  */
     static void
 win_free(wp, tp)
***************
*** 4526,4531 ****
--- 4526,4533 ----
     tabpage_T *tp;            /* tab page "win" is in, NULL for current */
 {
     int               i;
+     buf_T     *buf;
+     wininfo_T *wip;

 #ifdef FEAT_FOLDING
     clearFolding(wp);
***************
*** 4586,4591 ****
--- 4588,4600 ----

     vim_free(wp->w_localdir);

+     /* Remove the window from the b_wininfo lists, it may happen that the
+      * freed memory is re-used for another window. */
+     for (buf = firstbuf; buf != NULL; buf = buf->b_next)
+       for (wip = buf->b_wininfo; wip != NULL; wip = wip->wi_next)
+           if (wip->wi_win == wp)
+               wip->wi_win = NULL;
+
 #ifdef FEAT_SEARCH_EXTRA
     clear_matches(wp);
 #endif
*** ../vim-7.4a.043/src/version.c       2013-07-24 17:11:42.000000000 +0200
--- src/version.c       2013-07-24 17:39:43.000000000 +0200
***************
*** 729,730 ****
--- 729,732 ----
 {   /* Add new patch number below this line */
+ /**/
+     44,
 /**/

--
Computers are useless. They can only give you answers.
               -- Pablo Picasso

/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
\\\            help me help AIDS victims -- http://ICCF-Holland.org    ///