Skip to content

Commit

Permalink
fix: defer execution to avoid segfaults
Browse files Browse the repository at this point in the history
  • Loading branch information
apollo1321 committed Dec 4, 2024
1 parent 920999b commit 1d12cbb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lua/treesitter-context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ local function throttle_by_id(f, ms)
f(id) -- first call, execute immediately
timers[id]:start(ms, 0, function()
if waiting[id] then
vim.schedule(function() f(id) end) -- only execute if there are calls waiting
f(id) -- only execute if there are calls waiting
end
waiting[id] = nil
timers[id] = nil
Expand Down Expand Up @@ -173,7 +173,6 @@ function M.enable()

if config.multiwindow then
table.insert(update_events, 'WinResized')
table.insert(update_events, 'WinLeave')
end

autocmd(update_events, update)
Expand All @@ -189,7 +188,7 @@ function M.enable()
if config.multiwindow then
autocmd({ 'WinClosed' }, close)
else
autocmd({ 'BufLeave', 'WinLeave', 'WinClosed' }, close)
autocmd({ 'WinLeave', 'WinClosed' }, close)
end

autocmd('User', close, { pattern = 'SessionSavePre' })
Expand Down

0 comments on commit 1d12cbb

Please sign in to comment.