aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ui_bridge.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-02-22 15:51:28 +0100
committerGitHub <noreply@github.com>2018-02-22 15:51:28 +0100
commit15670ca1ad657945f69350b663e127f71f81d51c (patch)
treee0914547acfba001874f953f00c31996a7b1c403 /src/nvim/ui_bridge.c
parent8c8cf46c7100deb61d26e68241d86c20faace85b (diff)
parent8b05da157728e960b15c7e719a20eedb61637703 (diff)
downloadrneovim-15670ca1ad657945f69350b663e127f71f81d51c.tar.gz
rneovim-15670ca1ad657945f69350b663e127f71f81d51c.tar.bz2
rneovim-15670ca1ad657945f69350b663e127f71f81d51c.zip
Merge pull request #8050 from bfredl/stopbridge
ui_bridge: make sure TUI receives no more messages after "stop" message
Diffstat (limited to 'src/nvim/ui_bridge.c')
-rw-r--r--src/nvim/ui_bridge.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/ui_bridge.c b/src/nvim/ui_bridge.c
index c936a17e52..56e0c0c454 100644
--- a/src/nvim/ui_bridge.c
+++ b/src/nvim/ui_bridge.c
@@ -106,6 +106,9 @@ static void ui_thread_run(void *data)
static void ui_bridge_stop(UI *b)
{
+ // Detach brigde first, so that "stop" is the last event the TUI loop
+ // receives from the main thread. #8041
+ ui_detach_impl(b);
UIBridgeData *bridge = (UIBridgeData *)b;
bool stopped = bridge->stopped = false;
UI_BRIDGE_CALL(b, stop, 1, b);
@@ -122,7 +125,6 @@ static void ui_bridge_stop(UI *b)
uv_mutex_destroy(&bridge->mutex);
uv_cond_destroy(&bridge->cond);
xfree(bridge->ui); // Threads joined, now safe to free UI container. #7922
- ui_detach_impl(b);
xfree(b);
}
static void ui_bridge_stop_event(void **argv)