macos: fix a crash when InputCapture is dropped (#323)

This commit is contained in:
Ferdinand Schober
2025-10-08 00:22:52 +02:00
committed by GitHub
parent e46fe60b3e
commit e29eb7134c

View File

@@ -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