mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-10-26 09:58:16 +03:00
fix(core): deadlock on window destroy (#8953)
This commit is contained in:
parent
0606ab326b
commit
6edc563cf9
5
.changes/fix-window-destroy-deadlock.md
Normal file
5
.changes/fix-window-destroy-deadlock.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"tauri": patch:bug
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes a deadlock when the window is destroyed.
|
@ -528,7 +528,8 @@ impl<R: Runtime> AppManager<R> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn on_window_close(&self, label: &str) {
|
pub(crate) fn on_window_close(&self, label: &str) {
|
||||||
if let Some(window) = self.window.windows_lock().remove(label) {
|
let window = self.window.windows_lock().remove(label);
|
||||||
|
if let Some(window) = window {
|
||||||
for webview in window.webviews() {
|
for webview in window.webviews() {
|
||||||
self.webview.webviews_lock().remove(webview.label());
|
self.webview.webviews_lock().remove(webview.label());
|
||||||
}
|
}
|
||||||
|
@ -979,6 +979,10 @@ impl<R: Runtime> Webview<R> {
|
|||||||
.expect("could not locate webview parent window")
|
.expect("could not locate webview parent window")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn window_label(&self) -> String {
|
||||||
|
self.window_label.lock().unwrap().clone()
|
||||||
|
}
|
||||||
|
|
||||||
/// Executes a closure, providing it with the webview handle that is specific to the current platform.
|
/// Executes a closure, providing it with the webview handle that is specific to the current platform.
|
||||||
///
|
///
|
||||||
/// The closure is executed on the main thread.
|
/// The closure is executed on the main thread.
|
||||||
|
@ -988,7 +988,7 @@ impl<R: Runtime> Window<R> {
|
|||||||
.webview
|
.webview
|
||||||
.webviews_lock()
|
.webviews_lock()
|
||||||
.values()
|
.values()
|
||||||
.filter(|w| &w.window() == self)
|
.filter(|w| w.window_label() == self.label())
|
||||||
.cloned()
|
.cloned()
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user