Commit ecda7e67 authored by Sylvain Berfini's avatar Sylvain Berfini 🎩
Browse files

Fix too many unref crash in vcard tester

parent 3e314230
...@@ -814,6 +814,17 @@ LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, cons ...@@ -814,6 +814,17 @@ LinphoneFriend *linphone_core_get_friend_by_ref_key(const LinphoneCore *lc, cons
return lf; return lf;
} }
LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, SalOp *op) {
MSList *lists = lc->friends_lists;
LinphoneFriend *lf = NULL;
while (lists && !lf) {
LinphoneFriendList *list = (LinphoneFriendList *)lists->data;
lf = linphone_friend_list_find_friend_by_out_subscribe(list, op);
lists = ms_list_next(lists);
}
return lf;
}
#define key_compare(s1,s2) strcmp(s1,s2) #define key_compare(s1,s2) strcmp(s1,s2)
LinphoneSubscribePolicy __policy_str_to_enum(const char* pol){ LinphoneSubscribePolicy __policy_str_to_enum(const char* pol){
......
...@@ -670,7 +670,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon ...@@ -670,7 +670,7 @@ void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, Linphon
} else { } else {
ms_message("Friends list [%p] subscription update skipped since subscriptions not enabled yet", list); ms_message("Friends list [%p] subscription update skipped since subscriptions not enabled yet", list);
} }
} else { } else if (list->enable_subscriptions) {
for (elem = list->friends; elem != NULL; elem = elem->next) { for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data; LinphoneFriend *lf = (LinphoneFriend *)elem->data;
linphone_friend_update_subscribes(lf, cfg, only_when_registered); linphone_friend_update_subscribes(lf, cfg, only_when_registered);
......
...@@ -1889,10 +1889,10 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa ...@@ -1889,10 +1889,10 @@ void linphone_notify_recv(LinphoneCore *lc, SalOp *op, SalSubscribeStatus ss, Sa
LinphonePresenceModel *presence = model ? (LinphonePresenceModel *)model:linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline, NULL); LinphonePresenceModel *presence = model ? (LinphonePresenceModel *)model:linphone_presence_model_new_with_activity(LinphonePresenceActivityOffline, NULL);
if (linphone_core_get_default_friend_list(lc) != NULL) if (linphone_core_get_default_friend_list(lc) != NULL)
lf=linphone_friend_list_find_friend_by_out_subscribe(linphone_core_get_default_friend_list(lc), op); lf=linphone_core_find_friend_by_out_subscribe(lc, op);
if (lf==NULL && lp_config_get_int(lc->config,"sip","allow_out_of_subscribe_presence",0)){ if (lf==NULL && lp_config_get_int(lc->config,"sip","allow_out_of_subscribe_presence",0)){
const SalAddress *addr=sal_op_get_from_address(op); const SalAddress *addr=sal_op_get_from_address(op);
lf = linphone_friend_list_find_friend_by_address(linphone_core_get_default_friend_list(lc), (LinphoneAddress *)addr); lf = linphone_core_find_friend(lc, (LinphoneAddress *)addr);
} }
if (lf!=NULL){ if (lf!=NULL){
LinphonePresenceActivity *activity = NULL; LinphonePresenceActivity *activity = NULL;
......
...@@ -421,6 +421,7 @@ void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, SalOp *op); ...@@ -421,6 +421,7 @@ void linphone_friend_add_incoming_subscription(LinphoneFriend *lf, SalOp *op);
void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op); void linphone_friend_remove_incoming_subscription(LinphoneFriend *lf, SalOp *op);
LinphoneFriend *linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, SalOp *op); LinphoneFriend *linphone_friend_list_find_friend_by_inc_subscribe(const LinphoneFriendList *list, SalOp *op);
LinphoneFriend *linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, SalOp *op); LinphoneFriend *linphone_friend_list_find_friend_by_out_subscribe(const LinphoneFriendList *list, SalOp *op);
LinphoneFriend *linphone_core_find_friend_by_out_subscribe(const LinphoneCore *lc, SalOp *op);
MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf); MSList *linphone_find_friend_by_address(MSList *fl, const LinphoneAddress *addr, LinphoneFriend **lf);
bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc); bool_t linphone_core_should_subscribe_friends_only_when_registered(const LinphoneCore *lc);
void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered); void linphone_core_update_friends_subscriptions(LinphoneCore *lc, LinphoneProxyConfig *cfg, bool_t only_when_registered);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment