Skip to content

Commit

Permalink
fix(Manager): Don't retain references to dead targets.
Browse files Browse the repository at this point in the history
  • Loading branch information
pastaq committed Feb 11, 2025
1 parent d42b6fd commit ac77700
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/input/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ impl Manager {
continue;
};

self.composite_device_targets
.entry(device_path.clone())
.and_modify(|paths| {
paths.remove(&path);
});
log::debug!("Used target devices: {:?}", self.composite_device_targets);

let is_suspended = match device.is_suspended().await {
Ok(suspended) => suspended,
Err(e) => {
Expand All @@ -366,12 +373,6 @@ impl Manager {
.filter(|paf| paf.as_str() != device_path.as_str())
.collect();
log::info!("Gamepad order: {:?}", self.target_gamepad_order);

self.composite_device_targets
.entry(device_path)
.and_modify(|paths| {
paths.remove(&path);
});
}
ManagerCommand::DeviceAdded { device } => {
let dev_name = device.name();
Expand Down Expand Up @@ -686,7 +687,7 @@ impl Manager {
paths.insert(target_path.to_string());
paths
});
log::trace!("Used target devices: {:?}", self.composite_device_targets);
log::debug!("Used target devices: {:?}", self.composite_device_targets);

log::debug!("Finished handling attach request for: {target_path}");

Expand Down

0 comments on commit ac77700

Please sign in to comment.