Changeset 3988


Ignore:
Timestamp:
Mar 28, 2012 7:32:42 AM (12 years ago)
Author:
nanang
Message:

Re #1466: Moved down the atexit callbacks execution in pjmedia & pjsip endpoints to the very end of endpoint destroy sequence.

Location:
pjproject/branches/1.x
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/1.x/pjmedia/include/pjmedia/endpoint.h

    r3986 r3988  
    213213/** 
    214214 * Register cleanup function to be called by media endpoint when  
    215  * #pjmedia_endpt_destroy() is called. 
     215 * #pjmedia_endpt_destroy() is called. Note that application should not 
     216 * use or access any endpoint resource (such as pool, ioqueue) from within 
     217 * the callback as such resource may have been released when the callback 
     218 * function is invoked. 
    216219 * 
    217220 * @param endpt         The media endpoint. 
  • pjproject/branches/1.x/pjmedia/src/pjmedia/endpoint.c

    r3986 r3988  
    220220    } 
    221221 
     222    /* Destroy internal ioqueue */ 
     223    if (endpt->ioqueue && endpt->own_ioqueue) { 
     224        pj_ioqueue_destroy(endpt->ioqueue); 
     225        endpt->ioqueue = NULL; 
     226    } 
     227 
     228    endpt->pf = NULL; 
     229 
     230    pjmedia_codec_mgr_destroy(&endpt->codec_mgr); 
     231    pjmedia_aud_subsys_shutdown(); 
     232 
    222233    /* Call all registered exit callbacks */ 
    223234    ecb = endpt->exit_cb_list.next; 
     
    227238    } 
    228239 
    229     /* Destroy internal ioqueue */ 
    230     if (endpt->ioqueue && endpt->own_ioqueue) { 
    231         pj_ioqueue_destroy(endpt->ioqueue); 
    232         endpt->ioqueue = NULL; 
    233     } 
    234  
    235     endpt->pf = NULL; 
    236  
    237     pjmedia_codec_mgr_destroy(&endpt->codec_mgr); 
    238     pjmedia_aud_subsys_shutdown(); 
    239240    pj_pool_release (endpt->pool); 
    240241 
  • pjproject/branches/1.x/pjsip/include/pjsip/sip_endpoint.h

    r3986 r3988  
    521521/** 
    522522 * Register cleanup function to be called by SIP endpoint when  
    523  * #pjsip_endpt_destroy() is called. 
     523 * #pjsip_endpt_destroy() is called.  Note that application should not 
     524 * use or access any endpoint resource (such as pool, ioqueue, timer heap) 
     525 * from within the callback as such resource may have been released when 
     526 * the callback function is invoked. 
    524527 * 
    525528 * @param endpt         The SIP endpoint. 
  • pjproject/branches/1.x/pjsip/src/pjsip/sip_endpoint.c

    r3986 r3988  
    579579    PJ_LOG(5, (THIS_FILE, "Destroying endpoing instance..")); 
    580580 
    581     /* Call all registered exit callbacks */ 
    582     ecb = endpt->exit_cb_list.next; 
    583     while (ecb != &endpt->exit_cb_list) { 
    584         (*ecb->func)(endpt); 
    585         ecb = ecb->next; 
    586     } 
    587  
    588581    /* Phase 1: stop all modules */ 
    589582    mod = endpt->module_list.prev; 
     
    615608    /* Destroy timer heap */ 
    616609    pj_timer_heap_destroy(endpt->timer_heap); 
     610 
     611    /* Call all registered exit callbacks */ 
     612    ecb = endpt->exit_cb_list.next; 
     613    while (ecb != &endpt->exit_cb_list) { 
     614        (*ecb->func)(endpt); 
     615        ecb = ecb->next; 
     616    } 
    617617 
    618618    /* Delete endpoint mutex. */ 
Note: See TracChangeset for help on using the changeset viewer.