mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-30 13:20:06 -04:00
Avoid destroying the window twice (#388)
This commit is contained in:
committed by
Pierre Krieger
parent
7a1946589c
commit
b40b14f37f
@@ -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())
|
||||||
|
|||||||
Reference in New Issue
Block a user