Skip to content

Commit

Permalink
fix(CompositeDevice): use async task to set target devices on profile…
Browse files Browse the repository at this point in the history
… load to prevent crash
  • Loading branch information
ShadowApex committed May 6, 2024
1 parent f999714 commit 0432e6f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/input/composite_device/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1851,12 +1851,12 @@ impl CompositeDevice {

// Set the target devices to use if it is defined in the profile
if let Some(target_devices) = profile.target_devices {
if let Err(e) = self
.tx
.blocking_send(Command::SetTargetDevices(target_devices))
{
log::error!("Failed to send set target devices: {e:?}");
}
let tx = self.tx.clone();
tokio::task::spawn(async move {
if let Err(e) = tx.send(Command::SetTargetDevices(target_devices)).await {
log::error!("Failed to send set target devices: {e:?}");
}
});
}

log::debug!("Successfully loaded device profile: {}", profile.name);
Expand Down

0 comments on commit 0432e6f

Please sign in to comment.