diff options
author | Benny Prijono <bennylp@teluu.com> | 2014-06-04 09:23:10 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2014-06-04 09:23:10 +0000 |
commit | 9bd5e4dd99a742c764fa5839a7d5ff88c7bafc56 (patch) | |
tree | 0ed0955e2cade71c04f79ba298e686db0f624d78 | |
parent | 9c0d7acbbafa75b578afa89f5574fbfd84c24ec7 (diff) |
Misc (re #1751): invalidate timer entry for every cancel() scenario to avoid assertion next time the entry is scheduled if cancellation fails (thanks Johan Lantz for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4855 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjlib/src/pj/timer.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pjlib/src/pj/timer.c b/pjlib/src/pj/timer.c index 931a57fa..225be449 100644 --- a/pjlib/src/pj/timer.c +++ b/pjlib/src/pj/timer.c @@ -328,18 +328,23 @@ static int cancel( pj_timer_heap_t *ht, PJ_CHECK_STACK(); // Check to see if the timer_id is out of range - if (entry->_timer_id < 0 || (pj_size_t)entry->_timer_id > ht->max_size) + if (entry->_timer_id < 0 || (pj_size_t)entry->_timer_id > ht->max_size) { + entry->_timer_id = -1; return 0; + } timer_node_slot = ht->timer_ids[entry->_timer_id]; - if (timer_node_slot < 0) // Check to see if timer_id is still valid. + if (timer_node_slot < 0) { // Check to see if timer_id is still valid. + entry->_timer_id = -1; return 0; + } if (entry != ht->heap[timer_node_slot]) { if ((flags & F_DONT_ASSERT) == 0) pj_assert(entry == ht->heap[timer_node_slot]); + entry->_timer_id = -1; return 0; } else |