From a7a2f51283503dc2803a9ba0c3c2978b54f6243b Mon Sep 17 00:00:00 2001 From: Simon Morlat Date: Mon, 7 Feb 2011 13:59:14 +0100 Subject: [PATCH] fix un authenticated subscribes/notify at shutdown --- coreapi/friend.c | 18 ++++++++++++------ coreapi/linphonecore.c | 1 - coreapi/sal_eXosip2_presence.c | 1 + 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/coreapi/friend.c b/coreapi/friend.c index ee7013946..527e29bd5 100644 --- a/coreapi/friend.c +++ b/coreapi/friend.c @@ -277,7 +277,9 @@ SalPresenceStatus linphone_online_status_to_sal(LinphoneOnlineStatus os){ } void linphone_friend_notify(LinphoneFriend *lf, LinphoneOnlineStatus os){ - //printf("Wish to notify %p, lf->nid=%i\n",lf,lf->nid); + char *addr=linphone_address_as_string(linphone_friend_get_address(lf)); + ms_message("Want to notify %s, insub=%p",addr,lf->insub); + ms_free(addr); if (lf->insub!=NULL){ sal_notify_presence(lf->insub,linphone_online_status_to_sal(os),NULL); } @@ -286,8 +288,6 @@ void linphone_friend_notify(LinphoneFriend *lf, LinphoneOnlineStatus os){ static void linphone_friend_unsubscribe(LinphoneFriend *lf){ if (lf->outsub!=NULL) { sal_unsubscribe(lf->outsub); - sal_op_release(lf->outsub); - lf->outsub=NULL; lf->subscribe_active=FALSE; } } @@ -296,13 +296,19 @@ void linphone_friend_close_subscriptions(LinphoneFriend *lf){ linphone_friend_unsubscribe(lf); if (lf->insub){ sal_notify_close(lf->insub); - sal_op_release(lf->insub); - lf->insub=NULL; + } } void linphone_friend_destroy(LinphoneFriend *lf){ - + if (lf->insub) { + sal_op_release(lf->insub); + lf->insub=NULL; + } + if (lf->outsub){ + sal_op_release(lf->outsub); + lf->outsub=NULL; + } if (lf->uri!=NULL) linphone_address_destroy(lf->uri); if (lf->info!=NULL) buddy_info_free(lf->info); ms_free(lf); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index ad693a824..5d2042301 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -3850,7 +3850,6 @@ static void linphone_core_uninit(LinphoneCore *lc) usleep(50000); #endif } - if (lc->friends) ms_list_for_each(lc->friends,(void (*)(void *))linphone_friend_close_subscriptions); linphone_core_set_state(lc,LinphoneGlobalShutdown,"Shutting down"); diff --git a/coreapi/sal_eXosip2_presence.c b/coreapi/sal_eXosip2_presence.c index 52b1485a9..33034ed1c 100644 --- a/coreapi/sal_eXosip2_presence.c +++ b/coreapi/sal_eXosip2_presence.c @@ -39,6 +39,7 @@ SalOp * sal_find_out_subscribe(Sal *sal, int sid){ op=(SalOp*)elem->data; if (op->sid==sid) return op; } + ms_message("No op for sid %i",sid); return NULL; }