Wait for the Windows event loop to shut down
This fixes crashes when removing the instance and immediately unloading the module. `DestroyWindow()` is synchronous while `CloseWindow()` merely posts a message to close the window.
This commit is contained in:
parent
3761f9f5ee
commit
2f87a79d3e
|
@ -13,7 +13,7 @@ use windows::Win32::System::{
|
||||||
LibraryLoader::GetModuleHandleA, Performance::QueryPerformanceCounter,
|
LibraryLoader::GetModuleHandleA, Performance::QueryPerformanceCounter,
|
||||||
};
|
};
|
||||||
use windows::Win32::UI::WindowsAndMessaging::{
|
use windows::Win32::UI::WindowsAndMessaging::{
|
||||||
CloseWindow, CreateWindowExA, DefWindowProcA, GetWindowLongPtrA, PostMessageA,
|
CreateWindowExA, DefWindowProcA, DestroyWindow, GetWindowLongPtrA, PostMessageA,
|
||||||
RegisterClassExA, SetWindowLongPtrA, UnregisterClassA, CREATESTRUCTA, GWLP_USERDATA, HMENU,
|
RegisterClassExA, SetWindowLongPtrA, UnregisterClassA, CREATESTRUCTA, GWLP_USERDATA, HMENU,
|
||||||
WINDOW_EX_STYLE, WINDOW_STYLE, WM_CREATE, WM_DESTROY, WM_USER, WNDCLASSEXA,
|
WINDOW_EX_STYLE, WINDOW_STYLE, WM_CREATE, WM_DESTROY, WM_USER, WNDCLASSEXA,
|
||||||
};
|
};
|
||||||
|
@ -171,7 +171,7 @@ where
|
||||||
|
|
||||||
impl<T, E> Drop for WindowsEventLoop<T, E> {
|
impl<T, E> Drop for WindowsEventLoop<T, E> {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
unsafe { CloseWindow(self.message_window) };
|
unsafe { DestroyWindow(self.message_window) };
|
||||||
unsafe {
|
unsafe {
|
||||||
UnregisterClassA(
|
UnregisterClassA(
|
||||||
PSTR(self.message_window_class_name.as_bytes_with_nul().as_ptr()),
|
PSTR(self.message_window_class_name.as_bytes_with_nul().as_ptr()),
|
||||||
|
|
Loading…
Reference in a new issue