Changeset 2134


Ignore:
Timestamp:
Jul 14, 2008 9:55:01 AM (16 years ago)
Author:
bennylp
Message:

Related to ticket #518: only destroy the account and buddy pools after busy_sleep() is done, otherwise when unregistration callback is called, the callback will access accounts which are no longer valid because the pool has been destroyed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/src/pjsua-lib/pjsua_core.c

    r2133 r2134  
    10701070        pjsua_pres_shutdown(); 
    10711071 
    1072         /* Destroy pool in the buddy object */ 
    1073         for (i=0; i<(int)PJ_ARRAY_SIZE(pjsua_var.buddy); ++i) { 
    1074             if (pjsua_var.buddy[i].pool) { 
    1075                 pj_pool_release(pjsua_var.buddy[i].pool); 
    1076                 pjsua_var.buddy[i].pool = NULL; 
    1077             } 
    1078         } 
    1079  
    1080         /* Destroy accounts */ 
     1072        /* Unregister all accounts */ 
    10811073        for (i=0; i<(int)PJ_ARRAY_SIZE(pjsua_var.acc); ++i) { 
    10821074            if (!pjsua_var.acc[i].valid) 
     
    10851077            if (pjsua_var.acc[i].regc) { 
    10861078                pjsua_acc_set_registration(i, PJ_FALSE); 
    1087             } 
    1088  
    1089             if (pjsua_var.acc[i].pool) { 
    1090                 pj_pool_release(pjsua_var.acc[i].pool); 
    1091                 pjsua_var.acc[i].pool = NULL; 
    10921079            } 
    10931080        } 
     
    11041091        PJ_LOG(4,(THIS_FILE, "Shutting down...")); 
    11051092        busy_sleep(1000); 
     1093 
     1094        PJ_LOG(4,(THIS_FILE, "Destroying...")); 
     1095 
     1096        /* Destroy pool in the buddy object */ 
     1097        for (i=0; i<(int)PJ_ARRAY_SIZE(pjsua_var.buddy); ++i) { 
     1098            if (pjsua_var.buddy[i].pool) { 
     1099                pj_pool_release(pjsua_var.buddy[i].pool); 
     1100                pjsua_var.buddy[i].pool = NULL; 
     1101            } 
     1102        } 
     1103 
     1104        /* Destroy accounts */ 
     1105        for (i=0; i<(int)PJ_ARRAY_SIZE(pjsua_var.acc); ++i) { 
     1106            if (pjsua_var.acc[i].pool) { 
     1107                pj_pool_release(pjsua_var.acc[i].pool); 
     1108                pjsua_var.acc[i].pool = NULL; 
     1109            } 
     1110        } 
    11061111 
    11071112        pjsip_endpt_destroy(pjsua_var.endpt); 
Note: See TracChangeset for help on using the changeset viewer.