The debouncer's timer callback used a pattern that could cause a
double-unlock panic if the action function panicked:
d.mu.Lock()
defer d.mu.Unlock()
if d.seq == currentSeq {
d.mu.Unlock() // Manual unlock
d.action() // If this panics...
d.mu.Lock() // ...this never runs
} // ...but defer still tries to unlock
Fix: Remove the defer and manually manage lock state. Now if the
action panics, the lock is already released, preventing a
double-unlock panic that would mask the original panic.
Co-authored-by: Steven Syrek <steven.syrek@deepl.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1.7 KiB
1.7 KiB