fixed timeq: remove entry from list before executing callback
authorpk910 <philipp@zoelle1.de>
Sun, 8 Jan 2012 18:44:52 +0000 (19:44 +0100)
committerpk910 <philipp@zoelle1.de>
Sun, 8 Jan 2012 18:44:52 +0000 (19:44 +0100)
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;