Changeset 5180 for pjproject/trunk
- Timestamp:
- Sep 17, 2015 6:11:01 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/src/pjsip/sip_dialog.c
r5170 r5180 109 109 } 110 110 111 static void destroy_dialog( pjsip_dialog *dlg )111 static void destroy_dialog( pjsip_dialog *dlg, pj_bool_t unlock_mutex ) 112 112 { 113 113 if (dlg->mutex_) { 114 if (unlock_mutex) pj_mutex_unlock(dlg->mutex_); 114 115 pj_mutex_destroy(dlg->mutex_); 115 116 dlg->mutex_ = NULL; … … 303 304 304 305 on_error: 305 destroy_dialog(dlg );306 destroy_dialog(dlg, PJ_FALSE); 306 307 return status; 307 308 } … … 552 553 } 553 554 554 destroy_dialog(dlg );555 destroy_dialog(dlg, PJ_FALSE); 555 556 return status; 556 557 } … … 726 727 727 728 on_error: 728 destroy_dialog(dlg );729 destroy_dialog(dlg, PJ_FALSE); 729 730 return status; 730 731 } … … 734 735 * Destroy dialog. 735 736 */ 736 static pj_status_t unregister_and_destroy_dialog( pjsip_dialog *dlg ) 737 static pj_status_t unregister_and_destroy_dialog( pjsip_dialog *dlg, 738 pj_bool_t unlock_mutex ) 737 739 { 738 740 pj_status_t status; … … 758 760 759 761 /* Destroy this dialog. */ 760 destroy_dialog(dlg );762 destroy_dialog(dlg, unlock_mutex); 761 763 762 764 return PJ_SUCCESS; … … 775 777 PJ_ASSERT_RETURN(dlg->tsx_count==0, PJ_EINVALIDOP); 776 778 777 return unregister_and_destroy_dialog(dlg );779 return unregister_and_destroy_dialog(dlg, PJ_FALSE); 778 780 } 779 781 … … 894 896 pj_mutex_unlock(dlg->mutex_); 895 897 pj_mutex_lock(dlg->mutex_); 896 unregister_and_destroy_dialog(dlg); 898 /* We are holding the dialog mutex here, so before we destroy 899 * the dialog, make sure that we unlock it first to avoid 900 * undefined behaviour on some platforms. See ticket #1886. 901 */ 902 unregister_and_destroy_dialog(dlg, PJ_TRUE); 897 903 } else { 898 904 pj_mutex_unlock(dlg->mutex_);
Note: See TracChangeset
for help on using the changeset viewer.