Skip to content

Commit 9d33d09

Browse files
authored
fix(core): deadlock on plugin webview ready hook (#4462)
1 parent 13b8a24 commit 9d33d09

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

.changes/fix-plugin-deadlock.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fixes deadlock when a plugin window ready event needs to block the thread waiting on the event loop.

core/tauri/src/manager.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,14 +1192,16 @@ impl<R: Runtime> WindowManager<R> {
11921192
}
11931193

11941194
// let plugins know that a new window has been added to the manager
1195-
{
1196-
self
1197-
.inner
1195+
let manager = self.inner.clone();
1196+
let window_ = window.clone();
1197+
// run on main thread so the plugin store doesn't dead lock with the event loop handler in App
1198+
let _ = window.run_on_main_thread(move || {
1199+
manager
11981200
.plugins
11991201
.lock()
12001202
.expect("poisoned plugin store")
1201-
.created(window.clone());
1202-
}
1203+
.created(window_);
1204+
});
12031205

12041206
window
12051207
}

0 commit comments

Comments
 (0)