aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/winfloat.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2024-09-27 22:33:24 +0800
committerGitHub <noreply@github.com>2024-09-27 14:33:24 +0000
commitf55213ce0e2b0053ded8416e8ae922a0e406012f (patch)
tree9cb764c0922dccb0fada755a8723340327329643 /src/nvim/winfloat.c
parenteea6b84a87fb72d66f83e8b5c440764ccbdf69b5 (diff)
downloadrneovim-f55213ce0e2b0053ded8416e8ae922a0e406012f.tar.gz
rneovim-f55213ce0e2b0053ded8416e8ae922a0e406012f.tar.bz2
rneovim-f55213ce0e2b0053ded8416e8ae922a0e406012f.zip
fix(api): fix crash/leak with float title/footer on error (#30543)
Diffstat (limited to 'src/nvim/winfloat.c')
-rw-r--r--src/nvim/winfloat.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/nvim/winfloat.c b/src/nvim/winfloat.c
index e70f84ee7b..0a90f638f3 100644
--- a/src/nvim/winfloat.c
+++ b/src/nvim/winfloat.c
@@ -10,6 +10,7 @@
#include "nvim/ascii_defs.h"
#include "nvim/autocmd.h"
#include "nvim/buffer_defs.h"
+#include "nvim/decoration.h"
#include "nvim/drawscreen.h"
#include "nvim/errors.h"
#include "nvim/globals.h"
@@ -202,6 +203,12 @@ void win_config_float(win_T *wp, WinConfig fconfig)
wp->w_config.border_hl_ids,
sizeof fconfig.border_hl_ids) != 0);
+ if (fconfig.title_chunks.items != wp->w_config.title_chunks.items) {
+ clear_virttext(&wp->w_config.title_chunks);
+ }
+ if (fconfig.footer_chunks.items != wp->w_config.footer_chunks.items) {
+ clear_virttext(&wp->w_config.footer_chunks);
+ }
wp->w_config = fconfig;
bool has_border = wp->w_floating && wp->w_config.border;