fix(git): stop fs watcher before closing debounce timer

This commit is contained in:
2026-04-27 14:38:38 +02:00
parent c065487a42
commit c5b51f5ea5
+5 -1
View File
@@ -117,12 +117,16 @@ function Repo:start_watcher()
end
function Repo:stop_watcher()
self.refresh_handle.close()
-- Stop the libuv watcher first so no further fs-events can trigger
-- self:refresh(); only then tear down the debounce handle. The reverse
-- order leaves a window where an in-flight watcher callback would call
-- a closed debounce timer.
if self.watcher then
self.watcher:stop()
self.watcher:close()
self.watcher = nil
end
self.refresh_handle.close()
end
---@param buf integer