From dbd0ba67894cba9e7b6fc740e6db44c8d7480c8c Mon Sep 17 00:00:00 2001 From: phanium <91544758+phanen@users.noreply.github.com> Date: Fri, 19 Jun 2026 13:28:08 +0800 Subject: [PATCH] fix: close the timer to avoid memory leak --- lua/opencode/util.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/opencode/util.lua b/lua/opencode/util.lua index 304e05b1..3daa540f 100644 --- a/lua/opencode/util.lua +++ b/lua/opencode/util.lua @@ -352,10 +352,10 @@ function M.format_cost(c) end function M.debounce(func, delay) - local timer = nil + local timer ---@type uv.uv_timer_t? return function(...) - if timer then - timer:stop() + if timer and not timer:is_closing() then + timer:close() end local args = { ... } timer = vim.defer_fn(function()