fix: correctly handle Action abort if it has already completed (closes #2740)

This commit is contained in:
Greg Johnston 2024-07-28 21:24:04 -04:00
parent 6cc0604497
commit dcc43e574b

View file

@ -219,11 +219,10 @@ where
if let Some(owner) = &self.orig_owner { if let Some(owner) = &self.orig_owner {
owner.with(|| { owner.with(|| {
Owner::on_cleanup(move || { Owner::on_cleanup(move || {
abort_tx.send(()).expect( // If this fails, it is because the receiver has already dropped, i.e.,
"tried to cancel a future in \ // because the dispatched task has already completed. This means it can be
ArcAction::dispatch(), but the channel has \ // safely ignored, because it doesn't need to be aborted in any case.
already closed", let _ = abort_tx.send(());
);
}) })
}); });
} }