aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.c
diff options
context:
space:
mode:
authorgmntroll <37435952+gmntroll@users.noreply.github.com>2021-09-26 05:48:06 +0500
committerGitHub <noreply@github.com>2021-09-25 17:48:06 -0700
commit8b0e6cc05d767d414cfeb31ba90405b6e745fd9d (patch)
tree4341feb6ff7c36eb32d7923d2ac5a43551295c62 /src/nvim/api/private/helpers.c
parent2f9b9e61d7417183f2d9f36d804247c0926be9d4 (diff)
downloadrneovim-8b0e6cc05d767d414cfeb31ba90405b6e745fd9d.tar.gz
rneovim-8b0e6cc05d767d414cfeb31ba90405b6e745fd9d.tar.bz2
rneovim-8b0e6cc05d767d414cfeb31ba90405b6e745fd9d.zip
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
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r--src/nvim/api/private/helpers.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 541793e528..24d7c92ce3 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -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);