Skip to content

Commit b97e61f

Browse files
committed
fix: timer isn't garbage collected
I found many handler in debug.getregistry() point to here. Close the handler before nullify it.
1 parent 64dd4cf commit b97e61f

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lua/treesitter-context.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@ local function throttle_by_id(f)
4747
-- r was called again within throttling period; reschedule it.
4848
waiting[id] = nil
4949
r(id)
50-
else
50+
elseif timers[id] then
51+
if not timers[id]:is_closing() then
52+
timers[id]:stop()
53+
timers[id]:close()
54+
end
5155
-- Done - clean up
5256
timers[id] = nil
5357
end

0 commit comments

Comments
 (0)