mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 16:36:30 +00:00
fix(api): fix crash after set_option_value_for() #15390
Problem: This crashes Nvim: tabedit call nvim_win_set_option(1000, 'statusline', 'status') split wincmd J wincmd j Solution: - Change `no_display` parameter value to be the same as in matching `restore_win_noblock` call. In case of different values `topframe` isn't restored to `curtab->tp_topframe`. - Call `restore_win_noblock` if `switch_win_noblock` returns `FAIL` (`switch_win` must always have matching `restore_win`) - Change `switch_win`/`restore_win` to `_noblock` versions to allow autocommands. fixes #14097 fixes #13577
This commit is contained in:
@@ -1413,8 +1413,10 @@ static void set_option_value_for(char *key, int numval, char *stringval, int opt
|
||||
switch (opt_type)
|
||||
{
|
||||
case SREQ_WIN:
|
||||
if (switch_win(&save_curwin, &save_curtab, (win_T *)from,
|
||||
win_find_tabpage((win_T *)from), false) == FAIL) {
|
||||
if (switch_win_noblock(&save_curwin, &save_curtab, (win_T *)from,
|
||||
win_find_tabpage((win_T *)from), true)
|
||||
== FAIL) {
|
||||
restore_win_noblock(save_curwin, save_curtab, true);
|
||||
if (try_end(err)) {
|
||||
return;
|
||||
}
|
||||
@@ -1424,7 +1426,7 @@ static void set_option_value_for(char *key, int numval, char *stringval, int opt
|
||||
return;
|
||||
}
|
||||
set_option_value_err(key, numval, stringval, opt_flags, err);
|
||||
restore_win(save_curwin, save_curtab, true);
|
||||
restore_win_noblock(save_curwin, save_curtab, true);
|
||||
break;
|
||||
case SREQ_BUF:
|
||||
aucmd_prepbuf(&aco, (buf_T *)from);
|
||||
|
Reference in New Issue
Block a user