fix(kqueue): fix an unlocked snapshots usage

This commit is contained in:
CJ van den Berg 2026-03-14 19:08:13 +01:00
parent 79eb81c816
commit 94e150a522
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -419,7 +419,10 @@ pub fn remove_watch(self: *@This(), allocator: std.mem.Allocator, path: []const
std.posix.close(entry.value); std.posix.close(entry.value);
allocator.free(entry.key); allocator.free(entry.key);
} }
if (self.snapshots.fetchRemove(path)) |entry| { self.snapshots_mutex.lock();
const snap_entry = self.snapshots.fetchRemove(path);
self.snapshots_mutex.unlock();
if (snap_entry) |entry| {
var names = entry.value; var names = entry.value;
var it = names.iterator(); var it = names.iterator();
while (it.next()) |ne| { while (it.next()) |ne| {