diff --git a/src/timer.rs b/src/timer.rs index 944b893..8cb781c 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -22,7 +22,7 @@ struct TimerList { holder: Rc::>, wp: Rc::>>, timer_entry: Rc::>>, - attach_entry: Rc::>>, + attach_entry: Rc::>>, timer_type: i8, expire_time: i32, expires: i64, @@ -93,6 +93,12 @@ impl Timer { expires: 0, cb: None, })); + p.borrow_mut().holder = p.clone(); + p.borrow_mut().wp = Rc::new(p.borrow().holder.clone()); + p.borrow_mut().timer_entry = crate::ListHead::::new_node( + Rc::downgrade(&p.borrow().holder) + ); + p.borrow_mut().attach_entry = crate::ListHead::::new_head(); } return p; }