File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -86,9 +86,13 @@ fn deinit_keyboard_hook(hwnd: HWNDWrapper) {
8686 windows. remove ( & hwnd) ;
8787
8888 if windows. is_empty ( ) {
89- if let Ok ( Some ( hook) ) = HOOK . lock ( ) . as_deref ( ) {
90- unsafe {
91- UnhookWindowsHookEx ( hook. 0 ) ;
89+ if let Ok ( mut hook) = HOOK . lock ( ) {
90+ if let Some ( KeyboardHook ( hhook) ) = & mut * hook {
91+ unsafe {
92+ UnhookWindowsHookEx ( * hhook) ;
93+ }
94+
95+ * hook = None ;
9296 }
9397 }
9498 }
@@ -128,7 +132,9 @@ unsafe fn offer_message_to_baseview(msg: *mut MSG) -> bool {
128132 }
129133
130134 // check if this is one of our windows. if so, intercept it
131- if OPEN_WINDOWS . read ( ) . unwrap ( ) . contains ( & HWNDWrapper ( msg. hwnd ) ) {
135+ let Ok ( windows) = OPEN_WINDOWS . read ( ) else { return false } ;
136+
137+ if windows. contains ( & HWNDWrapper ( msg. hwnd ) ) {
132138 let _ = wnd_proc ( msg. hwnd , msg. message , msg. wParam , msg. lParam ) ;
133139
134140 return true ;
You can’t perform that action at this time.
0 commit comments