From f33d2d5d5a6e99e03d478728b05334b8cf770682 Mon Sep 17 00:00:00 2001 From: Ferdinand Schober Date: Tue, 7 Oct 2025 23:38:50 +0200 Subject: [PATCH] macos: fix a crash when InputCapture is dropped --- input-capture/src/macos.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/input-capture/src/macos.rs b/input-capture/src/macos.rs index 701f473..ec04f31 100644 --- a/input-capture/src/macos.rs +++ b/input-capture/src/macos.rs @@ -390,9 +390,9 @@ fn create_event_tap<'a>( if let Some(pos) = pos { res_events.iter().for_each(|e| { - event_tx - .blocking_send((pos, *e)) - .expect("Failed to send event"); + // error must be ignored, since the event channel + // may already be closed when the InputCapture instance is dropped. + let _ = event_tx.blocking_send((pos, *e)); }); // Returning None should stop the event from being processed // but core fundation still returns the event