Skip to content

Commit f33d2d5

Browse files
committed
macos: fix a crash when InputCapture is dropped
1 parent e46fe60 commit f33d2d5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

input-capture/src/macos.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ fn create_event_tap<'a>(
390390

391391
if let Some(pos) = pos {
392392
res_events.iter().for_each(|e| {
393-
event_tx
394-
.blocking_send((pos, *e))
395-
.expect("Failed to send event");
393+
// error must be ignored, since the event channel
394+
// may already be closed when the InputCapture instance is dropped.
395+
let _ = event_tx.blocking_send((pos, *e));
396396
});
397397
// Returning None should stop the event from being processed
398398
// but core fundation still returns the event

0 commit comments

Comments
 (0)