Fix crash when calling stop_timeout from the callback of a repeated timer
This commit is contained in:
parent
290ddc1fea
commit
7cd5c16fca
1 changed files with 9 additions and 2 deletions
|
@ -389,12 +389,19 @@ void callback_multi_timeout(void* arg)
|
|||
struct timespec cur_time;
|
||||
clock_gettime(CLOCK_MONOTONIC, &cur_time);
|
||||
GSList* it = mth->timeout_list;
|
||||
start:
|
||||
while (it) {
|
||||
timeout* t = it->data;
|
||||
if (++t->multi_timeout->current_count >= t->multi_timeout->count_to_expiration) {
|
||||
t->_callback(t->arg);
|
||||
if (multi_timeouts && g_hash_table_lookup(multi_timeouts, t)) {
|
||||
// Timer still exists
|
||||
t->multi_timeout->current_count = 0;
|
||||
t->timeout_expires = add_msec_to_timespec(cur_time, t->interval_msec);
|
||||
} else {
|
||||
it = mth->timeout_list;
|
||||
goto start;
|
||||
}
|
||||
}
|
||||
it = it->next;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue