aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2016-11-28 01:57:07 +0100
committerZyX <kp-pav@yandex.ru>2017-02-14 00:33:52 +0300
commit59f12e7d618340df181988488ec99f172c901d19 (patch)
treecb345b4a72344030088b7d372d6ba505ceeb01b2
parentd6705918870c8cf6c6a2eced220f59f59e7ce26f (diff)
downloadrneovim-59f12e7d618340df181988488ec99f172c901d19.tar.gz
rneovim-59f12e7d618340df181988488ec99f172c901d19.tar.bz2
rneovim-59f12e7d618340df181988488ec99f172c901d19.zip
ui_detach: Do not redraw during teardown/exit.
-rw-r--r--src/nvim/terminal.c4
-rw-r--r--src/nvim/ui.c5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c
index bd7b9fc58f..b0104a4e4c 100644
--- a/src/nvim/terminal.c
+++ b/src/nvim/terminal.c
@@ -977,9 +977,7 @@ static void refresh_terminal(Terminal *term)
// event.
static void refresh_timer_cb(TimeWatcher *watcher, void *data)
{
- if (exiting) {
- // bad things can happen if we redraw when exiting, and there's no need to
- // update the buffer.
+ if (exiting) { // Cannot redraw (requires event loop) during teardown/exit.
goto end;
}
Terminal *term;
diff --git a/src/nvim/ui.c b/src/nvim/ui.c
index d3784b6cd3..8c72c28e56 100644
--- a/src/nvim/ui.c
+++ b/src/nvim/ui.c
@@ -258,7 +258,10 @@ void ui_detach_impl(UI *ui)
shift_index++;
}
- if (--ui_count) {
+ if (--ui_count
+ // During teardown/exit the loop was already destroyed, cannot schedule.
+ // https://github.com/neovim/neovim/pull/5119#issuecomment-258667046
+ && !exiting) {
ui_schedule_refresh();
}
}