Skip to content

Commit 5c249a1

Browse files
committed
fix(single-instance): Fix compile errors after windows-sys 0.59 update, fixes #1730
1 parent 104f482 commit 5c249a1

File tree

1 file changed

+12
-12
lines changed
  • plugins/single-instance/src/platform_impl

1 file changed

+12
-12
lines changed

plugins/single-instance/src/platform_impl/windows.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
4949
unsafe {
5050
let hwnd = FindWindowW(class_name.as_ptr(), window_name.as_ptr());
5151

52-
if hwnd != 0 {
52+
if !hwnd.is_null() {
5353
let data = format!(
5454
"{}|{}\0",
5555
std::env::current_dir()
@@ -69,7 +69,7 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
6969
}
7070
}
7171
} else {
72-
app.manage(MutexHandle(hmutex));
72+
app.manage(MutexHandle(hmutex as _));
7373

7474
let hwnd = create_event_target_window::<R>(&class_name, &window_name);
7575
unsafe {
@@ -80,7 +80,7 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
8080
)
8181
};
8282

83-
app.manage(TargetWindowHandle(hwnd));
83+
app.manage(TargetWindowHandle(hwnd as _));
8484
}
8585

8686
Ok(())
@@ -96,12 +96,12 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
9696
pub fn destroy<R: Runtime, M: Manager<R>>(manager: &M) {
9797
if let Some(hmutex) = manager.try_state::<MutexHandle>() {
9898
unsafe {
99-
ReleaseMutex(hmutex.0);
100-
CloseHandle(hmutex.0);
99+
ReleaseMutex(hmutex.0 as _);
100+
CloseHandle(hmutex.0 as _);
101101
}
102102
}
103103
if let Some(hwnd) = manager.try_state::<TargetWindowHandle>() {
104-
unsafe { DestroyWindow(hwnd.0) };
104+
unsafe { DestroyWindow(hwnd.0 as _) };
105105
}
106106
}
107107

@@ -145,12 +145,12 @@ fn create_event_target_window<R: Runtime>(class_name: &[u16], window_name: &[u16
145145
cbClsExtra: 0,
146146
cbWndExtra: 0,
147147
hInstance: GetModuleHandleW(std::ptr::null()),
148-
hIcon: 0,
149-
hCursor: 0,
150-
hbrBackground: 0,
148+
hIcon: std::ptr::null_mut(),
149+
hCursor: std::ptr::null_mut(),
150+
hbrBackground: std::ptr::null_mut(),
151151
lpszMenuName: std::ptr::null(),
152152
lpszClassName: class_name.as_ptr(),
153-
hIconSm: 0,
153+
hIconSm: std::ptr::null_mut(),
154154
};
155155

156156
RegisterClassExW(&class);
@@ -174,8 +174,8 @@ fn create_event_target_window<R: Runtime>(class_name: &[u16], window_name: &[u16
174174
0,
175175
0,
176176
0,
177-
0,
178-
0,
177+
std::ptr::null_mut(),
178+
std::ptr::null_mut(),
179179
GetModuleHandleW(std::ptr::null()),
180180
std::ptr::null(),
181181
);

0 commit comments

Comments
 (0)