summaryrefslogtreecommitdiff
path: root/pjsip/src/pjsip/sip_transport.c
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2010-01-27 09:09:27 +0000
committerBenny Prijono <bennylp@teluu.com>2010-01-27 09:09:27 +0000
commit67983fb24f15e72df308c0e52f7055f38c09615c (patch)
tree690ab787b99e0ae17ff38c62f654d6af919d7229 /pjsip/src/pjsip/sip_transport.c
parent55f5a20f1f0385175e5d6b82695b78fbd738a2b3 (diff)
Fixed ticket #1036: Stray timer may be registered by SIP TCP and TLS transport in destroy routine, which could crash the program on Symbian (thanks Tamàs Solymosi for the report)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@3077 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjsip/src/pjsip/sip_transport.c')
-rw-r--r--pjsip/src/pjsip/sip_transport.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pjsip/src/pjsip/sip_transport.c b/pjsip/src/pjsip/sip_transport.c
index b6e79183..f5d7ee57 100644
--- a/pjsip/src/pjsip/sip_transport.c
+++ b/pjsip/src/pjsip/sip_transport.c
@@ -816,8 +816,10 @@ PJ_DEF(pj_status_t) pjsip_transport_dec_ref( pjsip_transport *tp )
if (pj_atomic_dec_and_get(tp->ref_cnt) == 0) {
pj_lock_acquire(tp->tpmgr->lock);
- /* Verify again. */
- if (pj_atomic_get(tp->ref_cnt) == 0) {
+ /* Verify again. Do not register timer if the transport is
+ * being destroyed.
+ */
+ if (pj_atomic_get(tp->ref_cnt) == 0 && !tp->is_destroying) {
pj_time_val delay;
/* If transport is in graceful shutdown, then this is the
@@ -898,6 +900,8 @@ static pj_status_t destroy_transport( pjsip_tpmgr *mgr,
pj_lock_acquire(tp->lock);
pj_lock_acquire(mgr->lock);
+ tp->is_destroying = PJ_TRUE;
+
/*
* Unregister timer, if any.
*/