Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion platforms/windows/examples/hello_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,14 @@ extern "system" fn wndproc(window: HWND, message: u32, wparam: WPARAM, lparam: L
LRESULT(0)
}
WM_GETOBJECT => {
let window_state = unsafe { &*get_window_state(window) };
let window_state = unsafe { get_window_state(window) };
if window_state.is_null() {
// We need to be prepared to gracefully handle WM_GETOBJECT
// while the window is being destroyed; this can happen if
// the thread is using a COM STA.
return unsafe { DefWindowProcW(window, message, wparam, lparam) };
}
let window_state = unsafe { &*window_state };
window_state.manager.handle_wm_getobject(wparam, lparam)
}
WM_SETFOCUS | WM_EXITMENULOOP | WM_EXITSIZEMOVE => {
Expand Down
9 changes: 8 additions & 1 deletion platforms/windows/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,14 @@ extern "system" fn wndproc(window: HWND, message: u32, wparam: WPARAM, lparam: L
LRESULT(0)
}
WM_GETOBJECT => {
let window_state = unsafe { &*get_window_state(window) };
let window_state = unsafe { get_window_state(window) };
if window_state.is_null() {
// We need to be prepared to gracefully handle WM_GETOBJECT
// while the window is being destroyed; this can happen if
// the thread is using a COM STA.
return unsafe { DefWindowProcW(window, message, wparam, lparam) };
}
let window_state = unsafe { &*window_state };
window_state.manager.handle_wm_getobject(wparam, lparam)
}
WM_SETFOCUS | WM_EXITMENULOOP | WM_EXITSIZEMOVE => {
Expand Down