chat: fix crash on iPad when having already some conversations started leading to "[CALayer retain]: message sent to deallocated instance" crash

This commit is contained in:
Gautier Pelloux-Prayer 2016-01-13 16:04:35 +01:00
parent a62aaee025
commit fc0181b75b
3 changed files with 10 additions and 6 deletions

View file

@ -36,8 +36,6 @@
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
self.tableView.accessibilityIdentifier = @"ChatRoom list";
// this should not be needed, we should only load messages when setting the chat room
// [self reloadData];
}
#pragma mark -

View file

@ -54,6 +54,15 @@
[self loadData];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
// we cannot do that in viewWillAppear because we will change view while previous transition
// was not finished, leading to "[CALayer retain]: message sent to deallocated instance" error msg
if (IPAD && [self totalNumberOfItems] == 0) {
[PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription];
}
}
#pragma mark -
static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRoom *elem) {
@ -115,9 +124,6 @@ static void chatTable_free_chatrooms(void *data) {
if ([self totalNumberOfItems] > 0) {
ChatConversationView *view = VIEW(ChatConversationView);
[view setChatRoom:(LinphoneChatRoom *)ms_list_nth_data(data, 0)];
[PhoneMainView.instance changeCurrentView:view.compositeViewDescription];
} else {
[PhoneMainView.instance changeCurrentView:ChatConversationCreateView.compositeViewDescription];
}
}
}

View file

@ -59,7 +59,7 @@ static UICompositeViewDescription *compositeDescription = nil;
sideMenu:SideMenuView.class
fullscreen:false
isLeftFragment:YES
fragmentWith:ChatConversationCreateView.class];
fragmentWith:ChatConversationView.class];
}
return compositeDescription;
}