• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision8db080710015c2a82b6cc0d8a5f03d541d03bca5 (tree)
Time2020-01-15 04:45:04
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.2.0118: crash when cycling to buffers involving popup window

Commit: https://github.com/vim/vim/commit/ca7c078b799bfc96b54e9e41f5be3e0bfefadce5
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Jan 14 20:42:48 2020 +0100

patch 8.2.0118: crash when cycling to buffers involving popup window
Problem: Crash when cycling to buffers involving popup window .
Solution: Do not decrement buffer reference count.

Change Summary

Incremental Difference

diff -r 9b7f90e56753 -r 8db080710015 src/popupwin.c
--- a/src/popupwin.c Tue Jan 14 19:30:04 2020 +0100
+++ b/src/popupwin.c Tue Jan 14 20:45:04 2020 +0100
@@ -937,10 +937,7 @@
937937
938938 nr = dict_get_number(dict, (char_u *)"hidden");
939939 if (nr > 0)
940- {
941940 wp->w_popup_flags |= POPF_HIDDEN;
942- --wp->w_buffer->b_nwindows;
943- }
944941
945942 popup_mask_refresh = TRUE;
946943 popup_highlight_curline(wp);
@@ -1153,7 +1150,6 @@
11531150 if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
11541151 {
11551152 wp->w_popup_flags |= POPF_HIDDEN;
1156- --wp->w_buffer->b_nwindows;
11571153 if (win_valid(wp->w_popup_prop_win))
11581154 redraw_win_later(wp->w_popup_prop_win, SOME_VALID);
11591155 }
@@ -2351,7 +2347,7 @@
23512347 if ((wp->w_popup_flags & POPF_HIDDEN) == 0)
23522348 {
23532349 wp->w_popup_flags |= POPF_HIDDEN;
2354- --wp->w_buffer->b_nwindows;
2350+ // Do not decrement b_nwindows, we still reference the buffer.
23552351 redraw_all_later(NOT_VALID);
23562352 popup_mask_refresh = TRUE;
23572353 }
@@ -2376,7 +2372,6 @@
23762372 if ((wp->w_popup_flags & POPF_HIDDEN) != 0)
23772373 {
23782374 wp->w_popup_flags &= ~POPF_HIDDEN;
2379- ++wp->w_buffer->b_nwindows;
23802375 redraw_all_later(NOT_VALID);
23812376 popup_mask_refresh = TRUE;
23822377 }
@@ -3154,7 +3149,6 @@
31543149 &prop, &lnum) == OK)
31553150 {
31563151 wp->w_popup_flags &= ~POPF_HIDDEN;
3157- ++wp->w_buffer->b_nwindows;
31583152 wp->w_popup_prop_topline = 0; // force repositioning
31593153 return TRUE;
31603154 }
diff -r 9b7f90e56753 -r 8db080710015 src/testdir/dumps/Test_popupwin_infopopup_7.dump
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/testdir/dumps/Test_popupwin_infopopup_7.dump Tue Jan 14 20:45:04 2020 +0100
@@ -0,0 +1,14 @@
1+|a+0&#ffffff0|w|o|r|d| @69
2+|t|e|s|t| |t|e|x|t| |a|w|o|r|d> @17|╔+0&#ffff4012|═@15|X| +0&#ffffff0@23
3+|~+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
4+|~| @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
5+|~| @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
6+|~| @73
7+|~| @73
8+|~| @73
9+|~| @73
10+|~| @73
11+|~| @73
12+|~| @73
13+|~| @73
14+|-+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
diff -r 9b7f90e56753 -r 8db080710015 src/testdir/test_popupwin.vim
--- a/src/testdir/test_popupwin.vim Tue Jan 14 19:30:04 2020 +0100
+++ b/src/testdir/test_popupwin.vim Tue Jan 14 20:45:04 2020 +0100
@@ -1045,7 +1045,7 @@
10451045 call assert_equal('hello', line)
10461046 call assert_equal(0, popup_getpos(winid).visible)
10471047 " buffer is still listed but hidden
1048- call assert_match(winbufnr(winid) .. 'u h.*\[Popup\]', execute('ls u'))
1048+ call assert_match(winbufnr(winid) .. 'u a.*\[Popup\]', execute('ls u'))
10491049
10501050 eval winid->popup_show()
10511051 redraw
@@ -2936,6 +2936,16 @@
29362936 call term_sendkeys(buf, "cc\<C-X>\<C-U>")
29372937 call VerifyScreenDump(buf, 'Test_popupwin_infopopup_6', {})
29382938
2939+ " Hide the info popup, cycle trough buffers, make sure it didn't get
2940+ " deleted.
2941+ call term_sendkeys(buf, "\<Esc>")
2942+ call term_sendkeys(buf, ":set hidden\<CR>")
2943+ call term_sendkeys(buf, ":bn\<CR>")
2944+ call term_sendkeys(buf, ":bn\<CR>")
2945+ call term_sendkeys(buf, "otest text test text\<C-X>\<C-U>")
2946+ call VerifyScreenDump(buf, 'Test_popupwin_infopopup_7', {})
2947+
2948+ call term_sendkeys(buf, "\<Esc>")
29392949 call StopVimInTerminal(buf)
29402950 call delete('XtestInfoPopup')
29412951 endfunc
diff -r 9b7f90e56753 -r 8db080710015 src/version.c
--- a/src/version.c Tue Jan 14 19:30:04 2020 +0100
+++ b/src/version.c Tue Jan 14 20:45:04 2020 +0100
@@ -743,6 +743,8 @@
743743 static int included_patches[] =
744744 { /* Add new patch number below this line */
745745 /**/
746+ 118,
747+/**/
746748 117,
747749 /**/
748750 116,
Show on old repository browser