diff --git a/src/platform/macos_iokit/events.rs b/src/platform/macos_iokit/events.rs index f0f3444..def21ce 100644 --- a/src/platform/macos_iokit/events.rs +++ b/src/platform/macos_iokit/events.rs @@ -51,11 +51,6 @@ pub(crate) fn add_event_source(source: CFRunLoopSource) -> EventRegistration { runloop.add_source(&source.0, unsafe { kCFRunLoopCommonModes }); tx.send(SendCFRunLoop(runloop)).unwrap(); CFRunLoop::run_current(); - - // Remove the global if we exited the run loop - let mut el = EVENT_LOOP.lock().unwrap(); - let _ = el.runloop.take(); - el.count = 0; info!("event loop thread exited"); }); event_loop.runloop = Some(rx.recv().expect("failed to start run loop thread")); @@ -78,6 +73,7 @@ impl Drop for EventRegistration { if event_loop.count == 0 { runloop.stop(); + event_loop.runloop.take(); } } }