fix(messages): avoid recursive rtp build due to msg_show #39888

Problem:  If there are pending messages when starting to build the
          runtime search path, a msg_show callback may invoke
          runtime_search_path_validate() recursively.
Solution: Avoid msg_show callback by ensuring messages are flushed.
(cherry picked from commit 53da0c5060)
This commit is contained in:
luukvbaal authored and github-actions[bot] committed 2026-05-20 13:04:08 +00:00
1 parent 8fccb26cd3
commit 33b6b0bfe5
2 files changed
+13

No files matched your search

+1
View File
@@ -933,6 +933,7 @@ void runtime_search_path_validate(void)
}
if (!runtime_search_path_valid) {
if (!runtime_search_path_ref) {
msg_ext_ui_flush(); // avoid recursion due to UI callback
runtime_search_path_free(runtime_search_path);
}
runtime_search_path = runtime_search_path_build();
+12
View File
@@ -1794,6 +1794,18 @@ describe('runtime:', function()
command('edit FTDETECT')
eq('SsABab', eval('g:aseq'))
end)
it('no crash for recursive search_path build #39815', function()
clear()
local screen = Screen.new()
fn.jobstart({
nvim_prog,
'--clean',
'+lua require("vim._core.ui2").enable()',
'+set rtp+=$FOO | set syntax',
}, { term = true, env = { VIMRUNTIME = os.getenv('VIMRUNTIME') } })
screen:expect({ any = 'syntax', none = 'Process exited 1' })
end)
end)
describe('user session', function()