aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2017-03-22 02:20:06 +0100
committerJustin M. Keyes <justinkz@gmail.com>2017-03-22 18:43:01 +0100
commit41bffeacff885b4904a1f456c6d56e016ad6f88c (patch)
treee0831e486cbf693b037322826d180243ce449844 /src
parent54f31187ba006049ba455a1eeea4781750a3958d (diff)
downloadrneovim-41bffeacff885b4904a1f456c6d56e016ad6f88c.tar.gz
rneovim-41bffeacff885b4904a1f456c6d56e016ad6f88c.tar.bz2
rneovim-41bffeacff885b4904a1f456c6d56e016ad6f88c.zip
vim-patch:8.0.0331
Problem: Restoring help snapshot accesses freed memory. (Dominique Pelle) Solution: Don't restore a snapshot when the window closes. https://github.com/vim/vim/commit/343b8c042967da82f2f022afa31f2c97a264c1c8
Diffstat (limited to 'src')
-rw-r--r--src/nvim/testdir/test_help.vim16
-rw-r--r--src/nvim/window.c6
2 files changed, 18 insertions, 4 deletions
diff --git a/src/nvim/testdir/test_help.vim b/src/nvim/testdir/test_help.vim
new file mode 100644
index 0000000000..26edc16107
--- /dev/null
+++ b/src/nvim/testdir/test_help.vim
@@ -0,0 +1,16 @@
+
+" Tests for :help
+
+func Test_help_restore_snapshot()
+ help
+ set buftype=
+ help
+ edit x
+ help
+ helpclose
+endfunc
+
+func Test_help_errors()
+ call assert_fails('help doesnotexist', 'E149:')
+ call assert_fails('help!', 'E478:')
+endfunc
diff --git a/src/nvim/window.c b/src/nvim/window.c
index ebb998e3af..a34daccb89 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -5365,10 +5365,8 @@ restore_snapshot (
clear_snapshot(curtab, idx);
}
-/*
- * Check if frames "sn" and "fr" have the same layout, same following frames
- * and same children.
- */
+/// Check if frames "sn" and "fr" have the same layout, same following frames
+/// and same children. And the window pointer is valid.
static int check_snapshot_rec(frame_T *sn, frame_T *fr)
{
if (sn->fr_layout != fr->fr_layout