From 4ec4723fbb0e6ef7fa478d2445799046c45cf4bf Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Tue, 26 Jul 2022 16:36:22 +0200 Subject: [PATCH] When destroying the linphone core, also destroy the magic search singleton This fixes bugs that would break the LDAP contact search after a remote provisioning. --- Classes/LinphoneManager.m | 1 + Classes/MagicSearch.swift | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 81504dad1..b7218dd7b 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1464,6 +1464,7 @@ void popup_link_account_cb(LinphoneAccountCreator *creator, LinphoneAccountCreat - (void)destroyLinphoneCore { // just in case [self removeCTCallCenterCb]; + [MagicSearchSingleton destroyInstance]; if (theLinphoneCore != nil) { // just in case application terminate before linphone core initialization diff --git a/Classes/MagicSearch.swift b/Classes/MagicSearch.swift index 65aa033b3..984091328 100644 --- a/Classes/MagicSearch.swift +++ b/Classes/MagicSearch.swift @@ -47,6 +47,10 @@ import linphonesw return theMagicSearchSingleton! } + @objc static func destroyInstance() { + theMagicSearchSingleton = nil + } + func getContactFromAddr(addr: Address) -> Contact? { return LinphoneManager.instance().fastAddressBook.addressBookMap.object(forKey: addr.asStringUriOnly() as Any) as? Contact