improv(wallpapers): reclaim memory when leaving page

This commit is contained in:
Michael Aaron Murphy 2025-01-23 14:27:58 +01:00
parent f4005a34de
commit 95a03e142d
No known key found for this signature in database
GPG key ID: B2732D4240C9212C

View file

@ -262,6 +262,11 @@ impl page::Page<crate::pages::Message> for Page {
}
fn on_leave(&mut self) -> Task<crate::pages::Message> {
// Reclaim memory
self.cached_display_handle = None;
self.selection = Context::default();
self.outputs = SingleSelectModel::default();
// Cancel the on_enter task if it was running.
if let Some(handle) = self.on_enter_handle.take() {
handle.abort();