From 1fde3a87bc22789244dbee2d1ac06f4c5f701e3f Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Wed, 16 Jun 2021 14:28:43 +0200 Subject: [PATCH 1/2] Use linphone_event_log_delete_from_database instead of linphone_chat_room_delete_message. --- Classes/ChatConversationTableView.m | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Classes/ChatConversationTableView.m b/Classes/ChatConversationTableView.m index 458ea6364..5673c0766 100644 --- a/Classes/ChatConversationTableView.m +++ b/Classes/ChatConversationTableView.m @@ -343,9 +343,7 @@ static const CGFloat MESSAGE_SPACING_PERCENTAGE = 1.f; - (void) tableView:(UITableView *)tableView deleteRowAtIndex:(NSIndexPath *)indexPath { [tableView beginUpdates]; LinphoneEventLog *event = [[eventList objectAtIndex:indexPath.row] pointerValue]; - // TODO: fix workaround - //linphone_event_log_delete_from_database(event); - linphone_chat_room_delete_message(_chatRoom, linphone_event_log_get_chat_message(event)); + linphone_event_log_delete_from_database(event); NSInteger index = indexPath.row + _currentIndex + (totalEventList.count - eventList.count); if (index < totalEventList.count) [totalEventList removeObjectAtIndex:index]; From 55a9850b38066058c65290296519b72cdf46973b Mon Sep 17 00:00:00 2001 From: QuentinArguillere Date: Wed, 16 Jun 2021 15:28:56 +0200 Subject: [PATCH 2/2] Fix a crash that could happen when changing view while deleting a chatroom --- Classes/ChatsListTableView.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 3c7e3ce0a..ae6ad0196 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -63,7 +63,11 @@ if (!chatRoom) continue; - linphone_chat_room_remove_callbacks(chatRoom, linphone_chat_room_get_current_callbacks(chatRoom)); + + LinphoneChatRoomCbs *cbs = linphone_chat_room_get_current_callbacks(chatRoom); + if (cbs) {// If the view is getting changed while a chatroom deletion is in progress, the callbacks may already have been deleted despite the chatroom still being there, causing a potential crash. + linphone_chat_room_remove_callbacks(chatRoom, cbs); + } _chatRooms = _chatRooms->next; } }