Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory leak and stopped animation when connecting/disconnecting monitor #375

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions daemon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,12 @@ impl wayland::interfaces::wl_output::EvHandler for Daemon {
fn done(&mut self, sender_id: ObjectId) {
for wallpaper in self.wallpapers.iter() {
if wallpaper.borrow().has_output(sender_id) {
wallpaper
if wallpaper
.borrow_mut()
.commit_surface_changes(self.use_cache);
self.stop_animations(&[wallpaper.clone()]);
.commit_surface_changes(self.use_cache)
{
self.stop_animations(&[wallpaper.clone()]);
}
break;
}
}
Expand Down Expand Up @@ -480,8 +482,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]);
}
}
}

Expand Down
Loading