Ignore:
Timestamp:
May 15, 2019 2:54:52 AM (5 years ago)
Author:
nanang
Message:

Re #2191: Fixed crash in SIP transport destroy due to bug introduced by r5971, i.e: group lock is set after registering tp to tpmgr, so tpmgr won't call pj_grp_lock_add_ref(), but in unregisteration, group lock is set, so tpmgr will call pj_grp_lock_dec_ref().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsip/sip_transport_udp.c

    r5984 r5991  
    471471    } 
    472472 
     473    /* When creating this transport, reference count was incremented to flag 
     474     * this transport as permanent so it will not be destroyed by transport 
     475     * manager whenever idle. Application may or may not have cleared the 
     476     * flag (by calling pjsip_transport_dec_ref()), so in case it has not, 
     477     * let's do it now, so this transport can be destroyed. 
     478     */ 
     479    if (pj_atomic_get(tp->base.ref_cnt) > 0) 
     480        pjsip_transport_dec_ref(&tp->base); 
     481 
     482    /* Destroy transport */ 
    473483    if (tp->grp_lock) { 
    474484        pj_grp_lock_t *grp_lock = tp->grp_lock; 
     
    845855    tp->base.destroy = &udp_destroy; 
    846856 
    847     /* This is a permanent transport, so we initialize the ref count 
    848      * to one so that transport manager don't destroy this transport 
    849      * when there's no user! 
    850      */ 
    851     pj_atomic_inc(tp->base.ref_cnt); 
    852  
    853857    /* Register to transport manager. */ 
    854858    tp->base.tpmgr = pjsip_endpt_get_tpmgr(endpt); 
     
    857861        goto on_error; 
    858862 
     863    /* This is a permanent transport, so we initialize the ref count 
     864     * to one so that transport manager won't destroy this transport 
     865     * when there's no user! 
     866     */ 
     867    pjsip_transport_add_ref(&tp->base); 
    859868 
    860869    /* Create rdata and put it in the array. */ 
Note: See TracChangeset for help on using the changeset viewer.