From 5c249a1a1076ac78cfc0ed4c2857cf7e2540b1cc Mon Sep 17 00:00:00 2001 From: FabianLars Date: Wed, 4 Sep 2024 10:29:29 +0200 Subject: [PATCH] fix(single-instance): Fix compile errors after windows-sys 0.59 update, fixes #1730 --- .../src/platform_impl/windows.rs | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/single-instance/src/platform_impl/windows.rs b/plugins/single-instance/src/platform_impl/windows.rs index a74cc5c59..9ec50edbe 100644 --- a/plugins/single-instance/src/platform_impl/windows.rs +++ b/plugins/single-instance/src/platform_impl/windows.rs @@ -49,7 +49,7 @@ pub fn init(f: Box>) -> TauriPlugin { unsafe { let hwnd = FindWindowW(class_name.as_ptr(), window_name.as_ptr()); - if hwnd != 0 { + if !hwnd.is_null() { let data = format!( "{}|{}\0", std::env::current_dir() @@ -69,7 +69,7 @@ pub fn init(f: Box>) -> TauriPlugin { } } } else { - app.manage(MutexHandle(hmutex)); + app.manage(MutexHandle(hmutex as _)); let hwnd = create_event_target_window::(&class_name, &window_name); unsafe { @@ -80,7 +80,7 @@ pub fn init(f: Box>) -> TauriPlugin { ) }; - app.manage(TargetWindowHandle(hwnd)); + app.manage(TargetWindowHandle(hwnd as _)); } Ok(()) @@ -96,12 +96,12 @@ pub fn init(f: Box>) -> TauriPlugin { pub fn destroy>(manager: &M) { if let Some(hmutex) = manager.try_state::() { unsafe { - ReleaseMutex(hmutex.0); - CloseHandle(hmutex.0); + ReleaseMutex(hmutex.0 as _); + CloseHandle(hmutex.0 as _); } } if let Some(hwnd) = manager.try_state::() { - unsafe { DestroyWindow(hwnd.0) }; + unsafe { DestroyWindow(hwnd.0 as _) }; } } @@ -145,12 +145,12 @@ fn create_event_target_window(class_name: &[u16], window_name: &[u16 cbClsExtra: 0, cbWndExtra: 0, hInstance: GetModuleHandleW(std::ptr::null()), - hIcon: 0, - hCursor: 0, - hbrBackground: 0, + hIcon: std::ptr::null_mut(), + hCursor: std::ptr::null_mut(), + hbrBackground: std::ptr::null_mut(), lpszMenuName: std::ptr::null(), lpszClassName: class_name.as_ptr(), - hIconSm: 0, + hIconSm: std::ptr::null_mut(), }; RegisterClassExW(&class); @@ -174,8 +174,8 @@ fn create_event_target_window(class_name: &[u16], window_name: &[u16 0, 0, 0, - 0, - 0, + std::ptr::null_mut(), + std::ptr::null_mut(), GetModuleHandleW(std::ptr::null()), std::ptr::null(), );