diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2021-09-14 18:29:59 +0200 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2021-09-14 21:01:15 +0200 |
commit | b86039b104b7e64d8c75d2afe2f603d2bdaec098 (patch) | |
tree | e6127ba88281cb0cbf207bc7c6fddc97d96bc274 | |
parent | 0a83017fe95df0290adb98ec6bf457b96a3fab17 (diff) | |
download | rneovim-b86039b104b7e64d8c75d2afe2f603d2bdaec098.tar.gz rneovim-b86039b104b7e64d8c75d2afe2f603d2bdaec098.tar.bz2 rneovim-b86039b104b7e64d8c75d2afe2f603d2bdaec098.zip |
fix(ui): don't log from UI events during free_all_mem()
Example assertion failure:
%0 in logmsg neovim/src/nvim/log.c:139:17
%1 in ui_call_update_menu neovim/build/src/nvim/auto/ui_events_call.generated.h:8:3
%2 in ex_menu neovim/src/nvim/menu.c:263:3
%3 in do_one_cmd neovim/src/nvim/ex_docmd.c:1981:5
%4 in do_cmdline neovim/src/nvim/ex_docmd.c:602:20
%5 in do_cmdline_cmd neovim/src/nvim/ex_docmd.c:287:10
%6 in free_all_mem neovim/src/nvim/memory.c:596:3
%7 in os_exit neovim/src/nvim/main.c:574:3
%8 in exit_event neovim/src/nvim/msgpack_rpc/channel.c:569:5
-rw-r--r-- | src/nvim/ui.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/nvim/ui.c b/src/nvim/ui.c index 94b6e9e39d..09709d0f43 100644 --- a/src/nvim/ui.c +++ b/src/nvim/ui.c @@ -69,9 +69,16 @@ static int pending_has_mouse = -1; #else static size_t uilog_seen = 0; static char uilog_last_event[1024] = { 0 }; + +#ifndef EXITFREE +#define entered_free_all_mem false +#endif + # define UI_LOG(funname) \ do { \ - if (strequal(uilog_last_event, STR(funname))) { \ + if (entered_free_all_mem) { \ + /* do nothing, we cannot log now */ \ + } else if (strequal(uilog_last_event, STR(funname))) { \ uilog_seen++; \ } else { \ if (uilog_seen > 0) { \ @@ -107,6 +114,10 @@ static char uilog_last_event[1024] = { 0 }; # include "ui_events_call.generated.h" #endif +#ifndef EXITFREE +#undef entered_free_all_mem +#endif + void ui_init(void) { default_grid.handle = 1; |