diff --git a/src/node.rs b/src/node.rs index 76030a38..52df470a 100644 --- a/src/node.rs +++ b/src/node.rs @@ -371,7 +371,11 @@ impl TreeBin { // not obtain new references to our thread handle. Also, // we just swapped out that handle, so it is no longer // reachable. - let _ = unsafe { waiter.into_owned() }; + // + // Now, we cannot safely drop this _immediately_, since + // we may have woken up and reached here _while_ some + // was trying to wake us up, so we defer_destroy instead. + unsafe { guard.defer_destroy(waiter) }; } return; }