mirror of
https://github.com/neovim/neovim.git
synced 2026-08-27 01:21:48 +00:00
Merge pull request #22023 from neovim/fix-syntax
* fix(treesitter): properly restore `'syntax'` (#21358) * fix(treesitter): really restore syntax - also unset b:ts_highlight on stop() Fixes: #21836
This commit is contained in:
@@ -135,6 +135,15 @@ void buf_updates_unregister(buf_T *buf, uint64_t channelid)
|
||||
}
|
||||
}
|
||||
|
||||
void buf_free_callbacks(buf_T *buf)
|
||||
{
|
||||
kv_destroy(buf->update_channels);
|
||||
for (size_t i = 0; i < kv_size(buf->update_callbacks); i++) {
|
||||
buffer_update_callbacks_free(kv_A(buf->update_callbacks, i));
|
||||
}
|
||||
kv_destroy(buf->update_callbacks);
|
||||
}
|
||||
|
||||
void buf_updates_unload(buf_T *buf, bool can_reload)
|
||||
{
|
||||
size_t size = kv_size(buf->update_channels);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
#include "nvim/api/extmark.h"
|
||||
#include "nvim/arglist.h"
|
||||
#include "nvim/buffer_updates.h"
|
||||
#include "nvim/context.h"
|
||||
#include "nvim/decoration_provider.h"
|
||||
#include "nvim/eval.h"
|
||||
@@ -814,6 +815,11 @@ void free_all_mem(void)
|
||||
bufref_T bufref;
|
||||
set_bufref(&bufref, buf);
|
||||
nextbuf = buf->b_next;
|
||||
|
||||
// Since options (in addition to other stuff) have been freed above we need to ensure no
|
||||
// callbacks are called, so free them before closing the buffer.
|
||||
buf_free_callbacks(buf);
|
||||
|
||||
close_buffer(NULL, buf, DOBUF_WIPE, false, false);
|
||||
// Didn't work, try next one.
|
||||
buf = bufref_valid(&bufref) ? nextbuf : firstbuf;
|
||||
|
||||
Reference in New Issue
Block a user