diff --git a/src/timer.c b/src/timer.c index e6d9a4a..01b51dc 100644 --- a/src/timer.c +++ b/src/timer.c @@ -244,9 +244,6 @@ int timer_clear(int timer_id) return -1; } - /* Found it, now unlink it from the queue */ - TAILQ_REMOVE(&tl, ptr, link); - /* protect against stopping timers in callbacks */ ptr->act = 0; @@ -255,6 +252,9 @@ int timer_clear(int timer_id) if (next) next->time += ptr->time; + /* Done manip. next entry, now safe to unlink from active queue */ + TAILQ_REMOVE(&tl, ptr, link); + if (ptr->data) { free(ptr->data); ptr->data = NULL;