mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: doesn't unlock before the task cancellation
This commit is contained in:
parent
e412478043
commit
d702cbcf9a
1 changed files with 4 additions and 3 deletions
|
|
@ -121,12 +121,13 @@ impl Tasks {
|
|||
}
|
||||
|
||||
pub fn cancel(&mut self) -> bool {
|
||||
let running = self.scheduler.running.read();
|
||||
if !running.get_id(self.cursor).map(|id| self.scheduler.cancel(id)).unwrap_or(false) {
|
||||
let id = self.scheduler.running.read().get_id(self.cursor);
|
||||
if id.map(|id| self.scheduler.cancel(id)) != Some(true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
self.cursor = self.cursor.min(running.len().saturating_sub(1));
|
||||
let len = self.scheduler.running.read().len();
|
||||
self.cursor = self.cursor.min(len.saturating_sub(1));
|
||||
true
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue