fix(core): deadlock on plugin webview ready hook (#4462)

This commit is contained in:
Lucas Fernandes Nogueira 2022-06-24 11:34:07 -07:00 committed by GitHub
parent 13b8a2403d
commit 9d33d09341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 5 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch
---
Fixes deadlock when a plugin window ready event needs to block the thread waiting on the event loop.

View File

@ -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
}