Patch 8.2.0118
Problem:    Crash when cycling to buffers involving popup window .
Solution:   Do not decrement buffer reference count.
Files:      src/popupwin.c, src/testdir/test_popupwin.vim,
            src/testdir/dumps/Test_popupwin_infopopup_7.dump


*** ../vim-8.2.0117/src/popupwin.c      2020-01-06 23:07:44.808998838 +0100
--- src/popupwin.c      2020-01-14 20:41:13.317173351 +0100
***************
*** 937,946 ****
  
      nr = dict_get_number(dict, (char_u *)"hidden");
      if (nr > 0)
-     {
        wp->w_popup_flags |= POPF_HIDDEN;
-       --wp->w_buffer->b_nwindows;
-     }
  
      popup_mask_refresh = TRUE;
      popup_highlight_curline(wp);
--- 937,943 ----
***************
*** 1153,1159 ****
            if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
            {
                wp->w_popup_flags |= POPF_HIDDEN;
-               --wp->w_buffer->b_nwindows;
                if (win_valid(wp->w_popup_prop_win))
                    redraw_win_later(wp->w_popup_prop_win, SOME_VALID);
            }
--- 1150,1155 ----
***************
*** 2351,2357 ****
      if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
      {
        wp->w_popup_flags |= POPF_HIDDEN;
!       --wp->w_buffer->b_nwindows;
        redraw_all_later(NOT_VALID);
        popup_mask_refresh = TRUE;
      }
--- 2347,2353 ----
      if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
      {
        wp->w_popup_flags |= POPF_HIDDEN;
!       // Do not decrement b_nwindows, we still reference the buffer.
        redraw_all_later(NOT_VALID);
        popup_mask_refresh = TRUE;
      }
***************
*** 2376,2382 ****
      if ((wp->w_popup_flags & POPF_HIDDEN) != 0)
      {
        wp->w_popup_flags &= ~POPF_HIDDEN;
-       ++wp->w_buffer->b_nwindows;
        redraw_all_later(NOT_VALID);
        popup_mask_refresh = TRUE;
      }
--- 2372,2377 ----
***************
*** 3154,3160 ****
                                                           &prop, &lnum) == OK)
        {
            wp->w_popup_flags &= ~POPF_HIDDEN;
-           ++wp->w_buffer->b_nwindows;
            wp->w_popup_prop_topline = 0; // force repositioning
            return TRUE;
        }
--- 3149,3154 ----
*** ../vim-8.2.0117/src/testdir/test_popupwin.vim       2020-01-06 
23:07:44.808998838 +0100
--- src/testdir/test_popupwin.vim       2020-01-14 20:40:10.793400390 +0100
***************
*** 1045,1051 ****
    call assert_equal('hello', line)
    call assert_equal(0, popup_getpos(winid).visible)
    " buffer is still listed but hidden
!   call assert_match(winbufnr(winid) .. 'u h.*\[Popup\]', execute('ls u'))
  
    eval winid->popup_show()
    redraw
--- 1045,1051 ----
    call assert_equal('hello', line)
    call assert_equal(0, popup_getpos(winid).visible)
    " buffer is still listed but hidden
!   call assert_match(winbufnr(winid) .. 'u a.*\[Popup\]', execute('ls u'))
  
    eval winid->popup_show()
    redraw
***************
*** 2936,2941 ****
--- 2936,2951 ----
    call term_sendkeys(buf, "cc\<C-X>\<C-U>")
    call VerifyScreenDump(buf, 'Test_popupwin_infopopup_6', {})
  
+   " Hide the info popup, cycle trough buffers, make sure it didn't get
+   " deleted.
+   call term_sendkeys(buf, "\<Esc>")
+   call term_sendkeys(buf, ":set hidden\<CR>")
+   call term_sendkeys(buf, ":bn\<CR>")
+   call term_sendkeys(buf, ":bn\<CR>")
+   call term_sendkeys(buf, "otest text test text\<C-X>\<C-U>")
+   call VerifyScreenDump(buf, 'Test_popupwin_infopopup_7', {})
+ 
+   call term_sendkeys(buf, "\<Esc>")
    call StopVimInTerminal(buf)
    call delete('XtestInfoPopup')
  endfunc
*** ../vim-8.2.0117/src/testdir/dumps/Test_popupwin_infopopup_7.dump    
2020-01-14 20:42:14.556950185 +0100
--- src/testdir/dumps/Test_popupwin_infopopup_7.dump    2020-01-14 
20:38:32.109756740 +0100
***************
*** 0 ****
--- 1,14 ----
+ |a+0&#ffffff0|w|o|r|d| @69
+ |t|e|s|t| |t|e|x|t| |a|w|o|r|d> @17|╔+0&#ffff4012|═@15|X| +0&#ffffff0@23
+ |~+0#4040ff13&| @7| +0#0000001#e0e0e08|w|r|d| @4|W| |e|x|t|r|a| |t|e|x|t| @1| 
+0#0000000#0000001|║+0&#ffff4012| |w|o|r|d|s| |a|r|e| |c|o@1|l| |║| 
+0#4040ff13#ffffff0@23
+ |~| @7| +0#0000001#ffd7ff255|a|n|o|t|w|r|d| |W| |e|x|t|r|a| |t|e|x|t| @1| 
+0#0000000#0000001|╚+0&#ffff4012|═@15|⇲| +0#4040ff13#ffffff0@23
+ |~| @7| +0#0000001#ffd7ff255|n|o|a|w|r|d| @1|W| |e|x|t|r|a| |t|e|x|t| @1| 
+0#0000000#a8a8a8255| +0#4040ff13#ffffff0@41
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |~| @73
+ |-+2#0000000&@1| |U|s|e|r| |d|e|f|i|n|e|d| |c|o|m|p|l|e|t|i|o|n| 
|(|^|U|^|N|^|P|)| |m+0#00e0003&|a|t|c|h| |1| |o|f| |4| +0#0000000&@26
*** ../vim-8.2.0117/src/version.c       2020-01-14 19:05:34.049710485 +0100
--- src/version.c       2020-01-14 20:41:26.973123645 +0100
***************
*** 744,745 ****
--- 744,747 ----
  {   /* Add new patch number below this line */
+ /**/
+     118,
  /**/

-- 
(letter from Mark to Mike, about the film's probable certificate)
      For an 'A' we would have to: Lose as many shits as possible; Take Jesus
      Christ out, if possible; Loose "I fart in your general direction"; Lose
      "the oral sex"; Lose "oh, fuck off"; Lose "We make castanets out of your
      testicles"
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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    ///

-- 
-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/202001141943.00EJhLRe027460%40masaka.moolenaar.net.

Raspunde prin e-mail lui