diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-10-25 09:59:02 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-25 09:59:02 +0800 |
commit | 684e93054b82c6b5b215db7d3ecbad803eb81f0e (patch) | |
tree | 4df579bfcad117e96b7546d5441c80cb62251280 /src/nvim/api/vim.c | |
parent | 1094d0c0dbd0f37ccc0f1d18c73c6066e5690664 (diff) | |
download | rneovim-684e93054b82c6b5b215db7d3ecbad803eb81f0e.tar.gz rneovim-684e93054b82c6b5b215db7d3ecbad803eb81f0e.tar.bz2 rneovim-684e93054b82c6b5b215db7d3ecbad803eb81f0e.zip |
fix(terminal): assign channel to terminal earlier (#25771)
Diffstat (limited to 'src/nvim/api/vim.c')
-rw-r--r-- | src/nvim/api/vim.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 52022cba5d..c3c619e206 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -1034,9 +1034,12 @@ Integer nvim_open_term(Buffer buffer, DictionaryOf(LuaRef) opts, Error *err) topts.write_cb = term_write; topts.resize_cb = term_resize; topts.close_cb = term_close; - Terminal *term = terminal_open(buf, topts); - terminal_check_size(term); - chan->term = term; + channel_incref(chan); + terminal_open(&chan->term, buf, topts); + if (chan->term != NULL) { + terminal_check_size(chan->term); + } + channel_decref(chan); return (Integer)chan->id; } |