This commit is contained in:
aozhiwei 2023-10-29 14:12:20 +08:00
parent a7e0c032f6
commit 4fbc56b86b

View File

@ -276,16 +276,17 @@ impl XTimer {
}
}
}
{
let running_timer = this.borrow().running_timer.clone();
match running_timer.upgrade() {
Some(v) => {
let timer_wp = Rc::downgrade(&v.borrow().wp.clone().unwrap());
let timer_wp = Rc::downgrade(&v.borrow().wp.as_ref().unwrap());
let timer_type = v.borrow().timer_type.clone();
let expire_time = v.borrow().expire_time;
match timer_type {
TimerType::Timeout => {
this.borrow_mut().internal_delete
(Rc::downgrade(&v.borrow().wp.clone().unwrap()),
(timer_wp,
false);
}
TimerType::Interval => {
@ -301,6 +302,7 @@ impl XTimer {
}
}
}
}
this.borrow_mut().running_timer = Weak::new();
}