Avoid destroying the window twice (#388)

This commit is contained in:
Gabriel Majeri 2018-03-25 21:30:16 +03:00 committed by Pierre Krieger
parent 7a1946589c
commit b40b14f37f

View file

@ -357,19 +357,10 @@ impl Drop for Window {
} }
} }
/// A simple wrapper that destroys the window when it is destroyed. /// A simple non-owning wrapper around a window.
#[doc(hidden)] #[doc(hidden)]
pub struct WindowWrapper(HWND, HDC); pub struct WindowWrapper(HWND, HDC);
impl Drop for WindowWrapper {
#[inline]
fn drop(&mut self) {
unsafe {
winuser::DestroyWindow(self.0);
}
}
}
unsafe fn init(window: WindowAttributes, pl_attribs: PlatformSpecificWindowBuilderAttributes, unsafe fn init(window: WindowAttributes, pl_attribs: PlatformSpecificWindowBuilderAttributes,
inserter: events_loop::Inserter) -> Result<Window, CreationError> { inserter: events_loop::Inserter) -> Result<Window, CreationError> {
let title = OsStr::new(&window.title).encode_wide().chain(Some(0).into_iter()) let title = OsStr::new(&window.title).encode_wide().chain(Some(0).into_iter())