diff --git a/src/platform/windows/mod.rs b/src/platform/windows/mod.rs index 5d982d50..2d43752f 100644 --- a/src/platform/windows/mod.rs +++ b/src/platform/windows/mod.rs @@ -342,6 +342,15 @@ impl Window { } } +impl Drop for Window { + #[inline] + fn drop(&mut self) { + unsafe { + user32::PostMessageW(self.window.0, winapi::WM_DESTROY, 0, 0); + } + } +} + pub struct PollEventsIterator<'a> { window: &'a Window, } @@ -367,14 +376,3 @@ impl<'a> Iterator for WaitEventsIterator<'a> { self.window.events_receiver.recv().ok() } } - -impl Drop for Window { - #[inline] - fn drop(&mut self) { - unsafe { - // we don't call MakeCurrent(0, 0) because we are not sure that the context - // is still the current one - user32::PostMessageW(self.window.0, winapi::WM_DESTROY, 0, 0); - } - } -}