fix(multiwebview): remove webview from store on close (#8766)

This commit is contained in:
Lucas Fernandes Nogueira 2024-02-04 23:22:09 -03:00 committed by GitHub
parent 48b1fd74b1
commit bd73ab0a1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 1 deletions

View File

@ -0,0 +1,5 @@
---
"tauri": patch:bug
---
When using the multiwebview mode, properly remove the webview from memory on `Webview::close`.

View File

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

View File

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