Fix race condition when restarting plugins that leads to crash

This commit is contained in:
Exidex 2024-09-08 16:07:04 +02:00
parent 56096f84fe
commit cdcda9fb75
No known key found for this signature in database
GPG key ID: 46D8D21671EB48FA

View file

@ -34,7 +34,7 @@ impl RunStatusHolder {
let mut running_plugins = self.running_plugins.lock().expect("lock is poisoned");
running_plugins
.get(plugin_id)
.remove(plugin_id)
.expect("value should always exist for specified id")
.cancel()
}
@ -56,10 +56,3 @@ impl RunStatusGuard {
.cancelled_owned()
}
}
impl Drop for RunStatusGuard {
fn drop(&mut self) {
let mut running_plugins = self.running_plugins.lock().expect("lock is poisoned");
running_plugins.remove(&self.id);
}
}