fixed timeq: remove entry from list before executing callback
[NeonServV5.git] / src / timeq.c
index 4ee011eac05bf73e5245be63ab57c281923e3033..41ed8a0e5b5153e31d018c6276df1ac0778864b2 100644 (file)
@@ -24,10 +24,10 @@ void timeq_tick() {
     time_t now = time(0);
     for(entry = timeq_events; entry; entry = next) {
         if(entry->execute <= now) {
-            entry->callback(entry->data);
             next = entry->next;
             if(timeq_events == entry)
                 timeq_events = next;
+            entry->callback(entry->data);
             free(entry);
         } else
             break;