]> granicus.if.org Git - vim/commitdiff
patch 8.1.1615: crash when passing buffer number to popup_create() v8.1.1615
authorBram Moolenaar <Bram@vim.org>
Mon, 1 Jul 2019 20:21:01 +0000 (22:21 +0200)
committerBram Moolenaar <Bram@vim.org>
Mon, 1 Jul 2019 20:21:01 +0000 (22:21 +0200)
Problem:    Crash when passing buffer number to popup_create(). (Yasuhiro
            Matsumoto)
Solution:   Initialze the window properly.

src/popupwin.c
src/testdir/test_popupwin.vim
src/version.c

index 3af35b6f05597630f07d15ceb1c62e25827a2eee..d988cbaf9b6212f80dffad4d5efa0cb431b0313d 100644 (file)
@@ -1056,8 +1056,7 @@ popup_create(typval_T *argvars, typval_T *rettv, create_type_T type)
     {
        // use existing buffer
        new_buffer = FALSE;
-       wp->w_buffer = buf;
-       ++buf->b_nwindows;
+       win_init_popup_win(wp, buf);
        buffer_ensure_loaded(buf);
     }
     else
index 32ce96be1120d5a70efbb99593c21e345748091c..f89d5660231eda5a54633acb7354989aec16c2c1 100644 (file)
@@ -1668,4 +1668,9 @@ func Test_popupwin_with_buffer()
   call assert_equal({}, popup_getpos(winid))
   call assert_equal(1, bufloaded(buf))
   exe 'bwipe! ' .. buf
+
+  edit test_popupwin.vim
+  let winid = popup_create(bufnr(''), {})
+  redraw
+  call popup_close(winid)
 endfunc
index 8a9f34743eed5072f984ce36788b69ac3108dbb7..ec541b46798811db5ed68cc5734f5e5f8c212bc4 100644 (file)
@@ -777,6 +777,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1615,
 /**/
     1614,
 /**/