fix(api): avoid memory leak with click functions in nvim_eval_statusline() (#21845)

Problem:    Allocated click function memory is lost due to
            `nvim_eval_statusline()` not passing in a `StlClickRecord`.
Solution:   Do not allocate click function memory if `tabtab == NULL`.

Resolve #21764, supersede #21842.
This commit is contained in:
luukvbaal
2023-01-17 00:31:36 +01:00
committed by GitHub
parent 9ccc6de8d3
commit da3460562e
2 changed files with 12 additions and 1 deletions

View File

@@ -3211,6 +3211,17 @@ describe('API', function()
'TextWithNoHighlight%#WarningMsg#TextWithWarningHighlight',
{ use_winbar = true, highlights = true }))
end)
it('no memory leak with click functions', function()
meths.eval_statusline('%@ClickFunc@StatusLineStringWithClickFunc%T', {})
eq({
str = 'StatusLineStringWithClickFunc',
width = 29
},
meths.eval_statusline(
'%@ClickFunc@StatusLineStringWithClickFunc%T',
{})
)
end)
end)
end)
describe('nvim_parse_cmd', function()