Skip to content

Commit

Permalink
fix(core): deadlock on plugin webview ready hook (#4462)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jun 24, 2022
1 parent 13b8a24 commit 9d33d09
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-plugin-deadlock.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Fixes deadlock when a plugin window ready event needs to block the thread waiting on the event loop.
12 changes: 7 additions & 5 deletions core/tauri/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1192,14 +1192,16 @@ impl<R: Runtime> WindowManager<R> {
}

// let plugins know that a new window has been added to the manager
{
self
.inner
let manager = self.inner.clone();
let window_ = window.clone();
// run on main thread so the plugin store doesn't dead lock with the event loop handler in App
let _ = window.run_on_main_thread(move || {
manager
.plugins
.lock()
.expect("poisoned plugin store")
.created(window.clone());
}
.created(window_);
});

window
}
Expand Down

0 comments on commit 9d33d09

Please sign in to comment.