Sorry, just to further elaborate, it seems the gentleman posting here: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2009-November/009682.html found like you did that when an audio device was removed you'd eventually get some kind of crash. So if you get the patch from the ticket he created there maybe it will solve your problem as well. Nikolay Popok wrote: > Hi guys. I'm using pjlib v1.5. > My application handles network events. When network dissapears, i > unregister all accounts and delete buddies from the lib by using > pjsua_buddy_del(pjsua_buddy_id). > When network appears, i reregister accounts and add buddies by > pjsua_buddy_add(pjsua_buddy_config,pjsua_buddy_id). Everything was > fine when i was using pjlib 1.4.5, > but in the new version there are problems. > > 1) After i removed buddies and unregistered accounts, I got next > warning in Xcode after few seconds (in debug this is not a crash, in > release i didn't try to run, just in case): > malloc: *** error for object 0x18d2200: double free > > Stack: > #3 0x968d038d in free > #4 0x0009c792 in default_block_free at pool_policy_malloc.c:78 > #5 0x000a1c85 in pj_pool_destroy_int at pool.c:290 > #6 0x000a2360 in cpool_release_pool at pool_caching.c:234 > #7 0x000a17e1 in pj_pool_release at pool_i.h:92 > #8 0x000bc910 in pjsip_endpt_release_pool at sip_endpoint.c:666 > #9 0x000ae776 in pjsip_publishc_destroy at publishc.c:219 > #10 0x000af548 in tsx_callback at publishc.c:678 > #11 0x000cf493 in mod_util_on_tsx_state at sip_util_statefull.c:78 > #12 0x000cc6c4 in tsx_set_state at sip_transaction.c:1108 > #13 0x000cdc23 in tsx_send_msg at sip_transaction.c:1898 > #14 0x000cdfc6 in tsx_retransmit at sip_transaction.c:2045 > #15 0x000ce1e4 in tsx_on_state_calling at sip_transaction.c:2148 > #16 0x000cc574 in tsx_timer_callback at sip_transaction.c:1055 > #17 0x000a6201 in pj_timer_heap_poll at timer.c:518 > #18 0x000bc95b in pjsip_endpt_handle_events2 at sip_endpoint.c:690 > #19 0x000e364e in pjsua_handle_events at pjsua_core.c:1476 > #20 0x000e16ca in worker_thread at pjsua_core.c:563 > #21 0x0009a303 in thread_main at os_core_unix.c:473 > > 2) When i'm trying to add buddies back, application crashes: > #0 0x000a5698 in pop_freelist at timer.c:136 > #1 0x000a5d0c in schedule_entry at timer.c:300 > #2 0x000a60a2 in pj_timer_heap_schedule at timer.c:472 > #3 0x000bca9b in pjsip_endpt_schedule_timer at sip_endpoint.c:759 > #4 0x000cefe4 in tsx_on_state_proceeding_uac at sip_transaction.c:2811 > #5 0x000cd3f9 in pjsip_tsx_recv_msg at sip_transaction.c:1627 > #6 0x000cbeb2 in mod_tsx_layer_on_rx_response at sip_transaction.c:830 > #7 0x000bcebe in endpt_on_rx_msg at sip_endpoint.c:927 > #8 0x000c2ff6 in pjsip_tpmgr_receive_packet at sip_transport.c:1473 > #9 0x000c37a2 in udp_on_read_complete at sip_transport_udp.c:164 > #10 0x00097b0f in ioqueue_dispatch_read_event at > ioqueue_common_abs.c:550 > #11 0x00099517 in pj_ioqueue_poll at ioqueue_select.c:765 > #12 0x000bc9cb in pjsip_endpt_handle_events2 at sip_endpoint.c:719 > #13 0x000e364e in pjsua_handle_events at pjsua_core.c:1476 > #14 0x000e16ca in worker_thread at pjsua_core.c:563 > #15 0x0009a303 in thread_main at os_core_unix.c:473 > > In pop_freelist function: > > // The freelist values in the <timer_ids_> are negative, so we need > // to negate them to get the next freelist "pointer." > ht->timer_ids_freelist = -ht->timer_ids[ht->timer_ids_freelist]; > // <-- crashes here, ht is not NULL > > 3) If i dont use adding/deleting, but call > pjsua_buddy_update_pres(pjsua_buddy_id) when network appears, i dont > get online status for buddies in callback from the lib (status is > PJSUA_BUDDY_STATUS_UNKNOWN). > > > Maybe i could help with additional info, just tell me what u need. > > ------------------------------------------------------------------------ > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip at lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > -- Jens B. Jorgensen jbj1 at ultraemail.net