From 0c0e04d7d27fbf956b39e602cd7fcfe3df94029d Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 26 Jul 2022 15:13:47 +0200 Subject: [PATCH] To avoid possible race condition, reload contacts in the global state change callbacks --- Classes/LinphoneManager.m | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 17fcdacb9..69bb19c6b 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -624,6 +624,11 @@ static void linphone_iphone_global_state_changed(LinphoneCore *lc, LinphoneGloba if (theLinphoneCore && linphone_core_get_global_state(theLinphoneCore) != LinphoneGlobalOff) [NSNotificationCenter.defaultCenter postNotificationName:kLinphoneGlobalStateUpdate object:self userInfo:dict]; }); + + if (state == LinphoneGlobalOn) { + // reload friends + [self.fastAddressBook fetchContactsInBackGroundThread]; + } } - (void)globalStateChangedNotificationHandler:(NSNotification *)notif { @@ -1473,8 +1478,6 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat - (void)resetLinphoneCore { [self destroyLinphoneCore]; [self createLinphoneCore]; - // reload friends - [self.fastAddressBook fetchContactsInBackGroundThread]; } static int comp_call_id(const LinphoneCall *call, const char *callid) {