fix(git): stop fs watcher before closing debounce timer
This commit is contained in:
+5
-1
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user