From a997b45c7e350ea5b378ca0c52ed3d4cc610975c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 17 Apr 2018 23:24:06 +0200 Subject: patch 8.0.1732: crash when terminal API call deletes the buffer Problem: Crash when terminal API call deletes the buffer. Solution: Lock the buffer while calling a function. (closes #2813) --- src/terminal.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/terminal.c') 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 -- cgit v1.2.1