From 7765e941ed99b6be6648b55b9d4442319c289cbd Mon Sep 17 00:00:00 2001 From: Viktor Lazarev Date: Thu, 29 Aug 2019 08:10:31 +0200 Subject: [PATCH] Implement Drop for Stream --- src/host/wasapi/stream.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/host/wasapi/stream.rs b/src/host/wasapi/stream.rs index e0c82db..3d57d92 100644 --- a/src/host/wasapi/stream.rs +++ b/src/host/wasapi/stream.rs @@ -148,12 +148,17 @@ impl EventLoop { } } -impl Drop for EventLoop { +impl Drop for Stream { #[inline] fn drop(&mut self) { unsafe { handleapi::CloseHandle(self.pending_scheduled_event); } + unsafe { + let result = synchapi::SetEvent(self.pending_scheduled_event); + assert!(result != 0); + } + self.thread.take().unwrap().join().unwrap(); } }