Skip to content

Commit

Permalink
fix(surface): Drop symlinks when the surface is destroyed
Browse files Browse the repository at this point in the history
  • Loading branch information
danyspin97 committed Nov 13, 2024
1 parent 1ad6566 commit 3578597
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions daemon/src/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,18 @@ impl Surface {
}
}

impl Drop for Surface {
fn drop(&mut self) {
// Do not leave any symlink when a surface gets destroyed
let link = self.xdg_state_home.join(&self.info.borrow().name);
if link.exists() {
if let Err(err) = fs::remove_file(&link) {
warn!("Could not delete symlink {link:?}: {err:?}");
}
}
}
}

fn black_image() -> RgbaImage {
RgbaImage::from_raw(1, 1, vec![0, 0, 0, 255]).unwrap()
}
Expand Down

0 comments on commit 3578597

Please sign in to comment.