mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-02-06 13:57:16 +00:00
fix(multiwebview): remove webview from store on close (#8766)
This commit is contained in:
parent
48b1fd74b1
commit
bd73ab0a1a
5
.changes/fix-webview-close.md
Normal file
5
.changes/fix-webview-close.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri": patch:bug
|
||||
---
|
||||
|
||||
When using the multiwebview mode, properly remove the webview from memory on `Webview::close`.
|
||||
@ -543,6 +543,10 @@ impl<R: Runtime> AppManager<R> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn on_webview_close(&self, label: &str) {
|
||||
self.webview.webviews_lock().remove(label);
|
||||
}
|
||||
|
||||
pub fn windows(&self) -> HashMap<String, Window<R>> {
|
||||
self.window.windows_lock().clone()
|
||||
}
|
||||
|
||||
@ -878,7 +878,9 @@ impl<R: Runtime> Webview<R> {
|
||||
if self.window.webview_window {
|
||||
self.window.close()
|
||||
} else {
|
||||
self.webview.dispatcher.close().map_err(Into::into)
|
||||
self.webview.dispatcher.close()?;
|
||||
self.manager().on_webview_close(self.label());
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user