fix(tauri-runtime-wry): deadlock on file drop, closes #4527 (#4535)

This commit is contained in:
Lucas Fernandes Nogueira 2022-06-30 10:38:21 -03:00 committed by GitHub
parent bf764e83e0
commit 23a48007c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 10 deletions

View File

@ -0,0 +1,5 @@
---
"tauri-runtime-wry": patch
---
Fixes a deadlock on the file drop handler.

View File

@ -3013,9 +3013,13 @@ fn create_file_drop_handler<T: UserEvent>(context: &Context<T>) -> Box<FileDropH
Box::new(move |window, event| {
let event: FileDropEvent = FileDropEventWrapper(event).into();
let window_event = WindowEvent::FileDrop(event);
let windows = windows.lock().unwrap();
if let Some(window) = windows.get(&webview_id_map.get(&window.id())) {
let listeners_map = window.window_event_listeners.lock().unwrap();
let window_event_listeners = windows
.lock()
.unwrap()
.get(&webview_id_map.get(&window.id()))
.map(|w| w.window_event_listeners.clone());
if let Some(window_event_listeners) = window_event_listeners {
let listeners_map = window_event_listeners.lock().unwrap();
let has_listener = !listeners_map.is_empty();
let handlers = listeners_map.values();
for listener in handlers {

View File

@ -3130,7 +3130,7 @@ dependencies = [
[[package]]
name = "tauri"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"anyhow",
"attohttpc",
@ -3192,7 +3192,7 @@ dependencies = [
[[package]]
name = "tauri-build"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"anyhow",
"cargo_toml",
@ -3206,7 +3206,7 @@ dependencies = [
[[package]]
name = "tauri-codegen"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"base64",
"brotli",
@ -3229,7 +3229,7 @@ dependencies = [
[[package]]
name = "tauri-macros"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"heck 0.4.0",
"proc-macro2",
@ -3241,7 +3241,7 @@ dependencies = [
[[package]]
name = "tauri-runtime"
version = "0.9.0"
version = "0.10.0"
dependencies = [
"gtk",
"http",
@ -3259,7 +3259,7 @@ dependencies = [
[[package]]
name = "tauri-runtime-wry"
version = "0.9.0"
version = "0.10.0"
dependencies = [
"cocoa",
"gtk",
@ -3277,7 +3277,7 @@ dependencies = [
[[package]]
name = "tauri-utils"
version = "1.0.0"
version = "1.0.1"
dependencies = [
"aes-gcm",
"brotli",