Loading ...
Sorry, an error occurred while loading the content.

Patch 7.4a.042

Expand Messages
  • Bram Moolenaar
    Patch 7.4a.042 Problem: Crash when BufUnload autocommands close all buffers. (Andrew Pimlott) Solution: Set curwin- w_buffer to curbuf to avoid NULL.
    Message 1 of 1 , Jul 24, 2013
    • 0 Attachment
      Patch 7.4a.042
      Problem: Crash when BufUnload autocommands close all buffers. (Andrew
      Pimlott)
      Solution: Set curwin->w_buffer to curbuf to avoid NULL.
      Files: src/window.c, src/testdir/test8.in, src/testdir/test8.ok


      *** ../vim-7.4a.041/src/window.c 2013-07-17 17:15:21.000000000 +0200
      --- src/window.c 2013-07-24 15:55:34.000000000 +0200
      ***************
      *** 2291,2298 ****
      if (only_one_window() && win_valid(win) && win->w_buffer == NULL
      && (last_window() || curtab != prev_curtab
      || close_last_window_tabpage(win, free_buf, prev_curtab)))
      ! /* Autocommands have close all windows, quit now. */
      getout(0);

      /* Autocommands may have closed the window already, or closed the only
      * other window or moved to another tab page. */
      --- 2291,2303 ----
      if (only_one_window() && win_valid(win) && win->w_buffer == NULL
      && (last_window() || curtab != prev_curtab
      || close_last_window_tabpage(win, free_buf, prev_curtab)))
      ! {
      ! /* Autocommands have close all windows, quit now. Restore
      ! * curwin->w_buffer, otherwise writing viminfo may fail. */
      ! if (curwin->w_buffer == NULL)
      ! curwin->w_buffer = curbuf;
      getout(0);
      + }

      /* Autocommands may have closed the window already, or closed the only
      * other window or moved to another tab page. */
      *** ../vim-7.4a.041/src/testdir/test8.in 2010-05-15 13:04:10.000000000 +0200
      --- src/testdir/test8.in 2013-07-24 15:55:09.000000000 +0200
      ***************
      *** 1,4 ****
      --- 1,5 ----
      Test for BufWritePre autocommand that deletes or unloads the buffer.
      + Test for BufUnload autocommand that unloads all other buffers.

      STARTTEST
      :so small.vim
      ***************
      *** 16,21 ****
      --- 17,43 ----
      :bwipe test.out " remove test.out from the buffer list
      :w " write it, will delete the buffer and give an error msg
      :w >>test.out " Append contents of this file
      + :au! BufWritePre
      + :func CloseAll()
      + let i = 0
      + while i <= bufnr('$')
      + if i != bufnr('%') && bufloaded(i)
      + exe i . "bunload"
      + endif
      + let i += 1
      + endwhile
      + endfunc
      + :func WriteToOut()
      + edit! test.out
      + $put ='VimLeave done'
      + write
      + endfunc
      + :set viminfo='100,nviminfo
      + :au BufUnload * call CloseAll()
      + :au VimLeave * call WriteToOut()
      + :e small.vim
      + :sp mbyte.vim
      + :q
      :qa!
      ENDTEST

      *** ../vim-7.4a.041/src/testdir/test8.ok 2010-05-15 13:04:10.000000000 +0200
      --- src/testdir/test8.ok 2013-07-24 15:40:16.000000000 +0200
      ***************
      *** 4,6 ****
      --- 4,7 ----
      start of Xxx1
      test
      end of Xxx
      + VimLeave done
      *** ../vim-7.4a.041/src/version.c 2013-07-24 15:02:00.000000000 +0200
      --- src/version.c 2013-07-24 15:55:54.000000000 +0200
      ***************
      *** 729,730 ****
      --- 729,732 ----
      { /* Add new patch number below this line */
      + /**/
      + 42,
      /**/

      --
      hundred-and-one symptoms of being an internet addict:
      23. You can't call your mother...she doesn't have a modem.

      /// Bram Moolenaar -- Bram@... -- 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 ///

      --
      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    Your message has been successfully submitted and would be delivered to recipients shortly.