From d7dbbba02a725128bf20b9cde23a9a29d11077b7 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Fri, 1 Mar 2024 09:32:12 -0800 Subject: [PATCH] fix bug in selector drop --- src/sys/windows/named_pipe.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sys/windows/named_pipe.rs b/src/sys/windows/named_pipe.rs index fa2abc4e6..3081ba555 100644 --- a/src/sys/windows/named_pipe.rs +++ b/src/sys/windows/named_pipe.rs @@ -942,7 +942,10 @@ fn event_done(status: &OVERLAPPED_ENTRY, events: Option<&mut Vec>) { let io = me.io.lock().unwrap(); // Make sure the I/O handle is still registered with the selector - if io.token.is_some() { + // + // This method is also called during `Selector::drop` to perform cleanup. In + // this case, `events` is `None` and we don't need to track the event. + if io.token.is_some() && events.is_some() { let mut ev = Event::from_completion_status(&status); // Reverse the `.data` alteration done in `schedule_event`. This // alteration was done so the selector recognized the event as one from