Fix memory leak and stopped animation

This commit is contained in:
kerty
2024-10-31 16:58:37 +03:00
parent 36808dfd90
commit e29735094f

View File

@@ -375,7 +375,6 @@ impl wayland::interfaces::wl_output::EvHandler for Daemon {
wallpaper
.borrow_mut()
.commit_surface_changes(self.use_cache);
self.stop_animations(&[wallpaper.clone()]);
break;
}
}
@@ -480,8 +479,14 @@ impl wayland::interfaces::zwlr_layer_surface_v1::EvHandler for Daemon {
}
fn closed(&mut self, sender_id: ObjectId) {
self.wallpapers
.retain(|w| !w.borrow().has_layer_surface(sender_id));
if let Some(i) = self
.wallpapers
.iter()
.position(|w| w.borrow().has_layer_surface(sender_id))
{
let w = self.wallpapers.remove(i);
self.stop_animations(&[w]);
}
}
}