mirror of
https://github.com/neovim/neovim.git
synced 2026-04-30 11:14:10 +00:00
fix(api): open_win leak from naughty autocommands
Problem: error set by win_set_buf may leak if autocommands immediately close the new window. Solution: free the error set by win_set_buf. (prefer nvim_open_win's error as it's more important and will cause 0 to be returned)
This commit is contained in:
@@ -337,6 +337,7 @@ Window nvim_open_win(Buffer buffer, Boolean enter, Dict(win_config) *config, Err
|
||||
}
|
||||
}
|
||||
if (!tp) {
|
||||
api_clear_error(err); // may have been set by win_set_buf
|
||||
api_set_error(err, kErrorTypeException, "Window was closed immediately");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user