summaryrefslogtreecommitdiff
path: root/src/terminal.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2018-04-17 23:24:06 +0200
committerBram Moolenaar <Bram@vim.org>2018-04-17 23:24:06 +0200
commita997b45c7e350ea5b378ca0c52ed3d4cc610975c (patch)
tree4ce7c2e8741723990ad32cea475b013215a250e8 /src/terminal.c
parente87edf3b85f607632e5431640071fdbc36b685b2 (diff)
downloadvim-git-a997b45c7e350ea5b378ca0c52ed3d4cc610975c.tar.gz
patch 8.0.1732: crash when terminal API call deletes the bufferv8.0.1732
Problem: Crash when terminal API call deletes the buffer. Solution: Lock the buffer while calling a function. (closes #2813)
Diffstat (limited to 'src/terminal.c')
-rw-r--r--src/terminal.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/terminal.c b/src/terminal.c
index 9a551a784..7f6e48db6 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -46,6 +46,9 @@
* switch to GUI, shell stops working. Scrollback seems wrong, command
* running in shell is still running.
* - GUI: when using tabs, focus in terminal, click on tab does not work.
+ * - handle_moverect() scrolls one line at a time. Postpone scrolling, count
+ * the number of lines, until a redraw happens. Then if scrolling many lines
+ * a redraw is faster.
* - Copy text in the vterm to the Vim buffer once in a while, so that
* completion works.
* - Redrawing is slow with Athena and Motif. Also other GUI? (Ramel Eshed)
@@ -3433,6 +3436,10 @@ parse_osc(const char *command, size_t cmdlen, void *user)
{
char_u *cmd = get_tv_string(&item->li_tv);
+ /* Make sure an invoked command doesn't delete the buffer (and the
+ * terminal) under our fingers. */
+ ++term->tl_buffer->b_locked;
+
item = item->li_next;
if (item == NULL)
ch_log(channel, "Missing argument for %s", cmd);
@@ -3442,6 +3449,7 @@ parse_osc(const char *command, size_t cmdlen, void *user)
handle_call_command(term, channel, item);
else
ch_log(channel, "Invalid command received: %s", cmd);
+ --term->tl_buffer->b_locked;
}
}
else