diff --git a/src/win/event.rs b/src/win/event.rs index 9fe3c36..fc11ed9 100644 --- a/src/win/event.rs +++ b/src/win/event.rs @@ -7,7 +7,7 @@ use winapi::um::winuser::{DefWindowProcA, WM_MOUSEMOVE, WM_PAINT, WM_TIMER}; const WIN_FRAME_TIMER: usize = 4242; -unsafe fn handle_timer(win: Arc>>, timer_id: usize) { +unsafe fn handle_timer(win: &Arc>>, timer_id: usize) { match timer_id { WIN_FRAME_TIMER => {} _ => (), @@ -15,7 +15,7 @@ unsafe fn handle_timer(win: Arc>>, timer_id: usize } pub(crate) unsafe fn handle_message( - win: Arc>>, + win: &Arc>>, message: UINT, wparam: WPARAM, lparam: LPARAM, diff --git a/src/win/window.rs b/src/win/window.rs index 5354443..70a371c 100644 --- a/src/win/window.rs +++ b/src/win/window.rs @@ -59,15 +59,15 @@ unsafe extern "system" fn wnd_proc( } _ => { if !win_ptr.is_null() { - let win_ref: Arc>> = + let win: Arc>> = Arc::from_raw(win_ptr as *mut Mutex>); - let win = Arc::clone(&win_ref); - let ret = handle_message(win, msg, wparam, lparam); + + let ret = handle_message(&win, msg, wparam, lparam); // todo: need_reconfigure thing? // If we don't do this, the Arc will be dropped and we'll get a crash. - let _ = Arc::into_raw(win_ref); + let _ = Arc::into_raw(win); return ret; } @@ -197,7 +197,7 @@ impl Window { break; } TranslateMessage(&mut msg); - handle_message(Arc::clone(&win_p), msg.message, msg.wParam, msg.lParam); + handle_message(&win_p, msg.message, msg.wParam, msg.lParam); } } }