mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-08-17 03:40:23 +03:00
fix(core): clear resource table in cleanup_before_exit
(#9505)
* Clear resource table in `cleanup_before_exit` * Add change file * Update .changes/cleanup-resource-table.md
This commit is contained in:
parent
05088b0679
commit
daf018e4f5
5
.changes/cleanup-resource-table.md
Normal file
5
.changes/cleanup-resource-table.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
tauri: patch:bug
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix resource tables not cleaned up on exit which causes tray icon inside resource tables not cleaned up on exit
|
@ -754,6 +754,13 @@ macro_rules! shared_app_impl {
|
|||||||
pub fn cleanup_before_exit(&self) {
|
pub fn cleanup_before_exit(&self) {
|
||||||
#[cfg(all(desktop, feature = "tray-icon"))]
|
#[cfg(all(desktop, feature = "tray-icon"))]
|
||||||
self.manager.tray.icons.lock().unwrap().clear();
|
self.manager.tray.icons.lock().unwrap().clear();
|
||||||
|
self.manager.resources_table().clear();
|
||||||
|
for (_, window) in self.manager.windows().iter() {
|
||||||
|
window.resources_table().clear();
|
||||||
|
}
|
||||||
|
for (_, webview) in self.manager.webviews().iter() {
|
||||||
|
webview.resources_table().clear();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1700,8 +1707,7 @@ tauri::Builder::default()
|
|||||||
if let Some(tooltip) = &tray_config.tooltip {
|
if let Some(tooltip) = &tray_config.tooltip {
|
||||||
tray = tray.tooltip(tooltip);
|
tray = tray.tooltip(tooltip);
|
||||||
}
|
}
|
||||||
let tray = tray.build(handle)?;
|
tray.build(handle)?;
|
||||||
app.manager.tray.icons.lock().unwrap().push(tray);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,4 +209,10 @@ impl ResourceTable {
|
|||||||
.ok_or_else(|| crate::Error::BadResourceId(rid))
|
.ok_or_else(|| crate::Error::BadResourceId(rid))
|
||||||
.map(|resource| resource.close())
|
.map(|resource| resource.close())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Removes and frees all resources stored. Note that the
|
||||||
|
/// resource's `close()` method is *not* called.
|
||||||
|
pub(crate) fn clear(&mut self) {
|
||||||
|
self.index.clear()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user