summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-09-08 23:35:30 +0200
committerBram Moolenaar <Bram@vim.org>2016-09-08 23:35:30 +0200
commitc4a908e83690844b0d3a46124ba6af7d23485d69 (patch)
tree1a38f95d4fb857bd49b70a60e9de225c19b4574a /src/buffer.c
parentabd468ed0fbcba391e7833feeaa7de3ced841455 (diff)
downloadvim-git-c4a908e83690844b0d3a46124ba6af7d23485d69.tar.gz
patch 7.4.2347v7.4.2347
Problem: Crash when closing a buffer while Visual mode is active. (Dominique Pelle) Solution: Adjust the position before computing the number of lines. When closing the current buffer stop Visual mode.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 398fee7b6..3bfd97522 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -578,6 +578,11 @@ aucmd_abort:
if (buf->b_ffname == NULL)
del_buf = TRUE;
+ /* When closing the current buffer stop Visual mode before freeing
+ * anything. */
+ if (buf == curbuf)
+ end_visual_mode();
+
/*
* Free all things allocated for this buffer.
* Also calls the "BufDelete" autocommands when del_buf is TRUE.
@@ -1379,6 +1384,10 @@ do_buffer(
}
}
+ /* When closing the current buffer stop Visual mode. */
+ if (buf == curbuf)
+ end_visual_mode();
+
/*
* If deleting the last (listed) buffer, make it empty.
* The last (listed) buffer cannot be unloaded.