fix crash when remove callbacks

This commit is contained in:
Danmei Chen 2020-06-10 14:59:00 +02:00
parent f1bc077efa
commit 29d484ea34
3 changed files with 5 additions and 8 deletions

View file

@ -112,5 +112,6 @@
- (void)showFileDownloadError;
- (NSURL *)getICloudFileUrl:(NSString *)name;
- (BOOL)writeFileInICloud:(NSData *)data fileURL:(NSURL *)fileURL;
- (void)removeCallBacks;
@end

View file

@ -175,10 +175,6 @@ static UICompositeViewDescription *compositeDescription = nil;
selector:@selector(onLinphoneCoreReady:)
name:kLinphoneGlobalStateUpdate
object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(didEnterBackground:)
name:UIApplicationDidEnterBackgroundNotification
object:nil];
if ([_imagesArray count] > 0) {
[UIView animateWithDuration:0
delay:0
@ -213,10 +209,6 @@ static UICompositeViewDescription *compositeDescription = nil;
PhoneMainView.instance.currentRoom = NULL;
}
- (void)didEnterBackground:(NSNotification *)notif {
[self removeCallBacks];
}
- (void)removeCallBacks {
if (_chatRoom && _chatRoomCbs) {
linphone_chat_room_remove_callbacks(_chatRoom, _chatRoomCbs);

View file

@ -60,6 +60,10 @@
if (linphone_core_get_global_state(LC) != LinphoneGlobalOff) {
[LinphoneManager.instance enterBackgroundMode];
[LinphoneManager.instance.fastAddressBook clearFriends];
if (PhoneMainView.instance.currentView == ChatConversationView.compositeViewDescription) {
ChatConversationView *view = VIEW(ChatConversationView);
[view removeCallBacks];
}
[CoreManager.instance stopLinphoneCore];
}
}