don't need to reset userdata, just leak the Arc with into_raw so it stays alive
This commit is contained in:
parent
6e7038d26e
commit
9d39ba9117
|
@ -35,9 +35,7 @@ pub(crate) unsafe fn handle_message<A: AppWindow>(
|
|||
handle_timer(win, wparam);
|
||||
0
|
||||
}
|
||||
WM_PAINT => {
|
||||
0
|
||||
}
|
||||
WM_PAINT => 0,
|
||||
_ => DefWindowProcA(hwnd, message, wparam, lparam),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,10 +68,8 @@ unsafe extern "system" fn wnd_proc<A: AppWindow>(
|
|||
|
||||
// todo: need_reconfigure thing?
|
||||
|
||||
// Needed otherwise it crashes because it drops the userdata
|
||||
// We basically need to keep the GWLP_USERDATA fresh between calls of the proc
|
||||
// DO NOT REMOVE
|
||||
SetWindowLongPtrA(hwnd, GWLP_USERDATA, Arc::into_raw(win_ref) as *const _ as _);
|
||||
// If we don't do this, the Arc will be dropped and we'll get a crash.
|
||||
let _ = Arc::into_raw(win_ref);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue