mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-07 18:28:39 +02:00
fix(windows): fix dangling pointers (#14)
* fix(windows): fix dangling pointers a fix to some dangling problem same as https://github.com/tauri-apps/tauri-plugin-single-instance/pull/6 * doc(change): add a change md
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri-plugin-single-instance": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
fix dangling pointers caused by passing `encode_wide().as_ptr()` directly to FFI on Windows.
|
||||||
@@ -33,12 +33,13 @@ pub fn init<R: Runtime>(f: Box<SingleInstanceCallback<R>>) -> TauriPlugin<R> {
|
|||||||
|
|
||||||
let class_name = encode_wide(format!("{}-sic", id));
|
let class_name = encode_wide(format!("{}-sic", id));
|
||||||
let window_name = encode_wide(format!("{}-siw", id));
|
let window_name = encode_wide(format!("{}-siw", id));
|
||||||
|
let mutex_name = encode_wide(format!("{}-sim", id));
|
||||||
|
|
||||||
let hmutex = unsafe {
|
let hmutex = unsafe {
|
||||||
CreateMutexW(
|
CreateMutexW(
|
||||||
std::ptr::null(),
|
std::ptr::null(),
|
||||||
true.into(),
|
true.into(),
|
||||||
encode_wide(format!("{}-sim", id)).as_ptr(),
|
mutex_name.as_ptr(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user