diff --git a/Classes/ChatConversationView.m b/Classes/ChatConversationView.m index 0e7b5294d..a904efbdc 100644 --- a/Classes/ChatConversationView.m +++ b/Classes/ChatConversationView.m @@ -273,8 +273,7 @@ static UICompositeViewDescription *compositeDescription = nil; } // we must ref & unref message because in case of error, it will be destroy otherwise - linphone_chat_room_send_chat_message(_chatRoom, linphone_chat_message_ref(msg)); - linphone_chat_message_unref(msg); + linphone_chat_room_send_chat_message(_chatRoom, msg); if (linphone_core_lime_enabled(LC) == LinphoneLimeMandatory && !linphone_chat_room_lime_available(_chatRoom)) { [LinphoneManager.instance alertLIME:_chatRoom]; diff --git a/Classes/ChatsListTableView.m b/Classes/ChatsListTableView.m index 16ed81712..7a8bfaecd 100644 --- a/Classes/ChatsListTableView.m +++ b/Classes/ChatsListTableView.m @@ -40,12 +40,6 @@ return self; } -- (void)dealloc { - if (data != nil) { - bctbx_list_free_with_data(data, chatTable_free_chatrooms); - } -} - #pragma mark - ViewController Functions - (void)viewWillAppear:(BOOL)animated { @@ -98,26 +92,13 @@ static int sorted_history_comparison(LinphoneChatRoom *to_insert, LinphoneChatRo LinphoneChatRoom *chat_room = iter->data; LinphoneChatMessage *last_msg = linphone_chat_room_get_last_message_in_history(chat_room); linphone_chat_room_set_user_data(chat_room, last_msg); - sorted = bctbx_list_insert_sorted(sorted, linphone_chat_room_ref(chat_room), - (bctbx_compare_func)sorted_history_comparison); + sorted = bctbx_list_insert_sorted(sorted, chat_room, (bctbx_compare_func)sorted_history_comparison); iter = iter->next; } return sorted; } -static void chatTable_free_chatrooms(void *data) { - LinphoneChatMessage *last_msg = linphone_chat_room_get_user_data(data); - if (last_msg) { - linphone_chat_message_unref(last_msg); - linphone_chat_room_set_user_data(data, NULL); - } - linphone_chat_room_unref(data); -} - - (void)loadData { - if (data != NULL) { - bctbx_list_free_with_data(data, chatTable_free_chatrooms); - } data = [self sortChatRooms]; [super loadData]; @@ -190,12 +171,6 @@ static void chatTable_free_chatrooms(void *data) { [tableView beginUpdates]; LinphoneChatRoom *chatRoom = (LinphoneChatRoom *)bctbx_list_nth_data(data, (int)[indexPath row]); - LinphoneChatMessage *last_msg = linphone_chat_room_get_user_data(chatRoom); - if (last_msg) { - linphone_chat_message_unref(last_msg); - linphone_chat_room_set_user_data(chatRoom, NULL); - } - FileTransferDelegate *ftdToDelete = nil; for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) { if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) { @@ -220,12 +195,6 @@ static void chatTable_free_chatrooms(void *data) { - (void)removeSelectionUsing:(void (^)(NSIndexPath *))remover { [super removeSelectionUsing:^(NSIndexPath *indexPath) { LinphoneChatRoom *chatRoom = (LinphoneChatRoom *)bctbx_list_nth_data(data, (int)[indexPath row]); - LinphoneChatMessage *last_msg = linphone_chat_room_get_user_data(chatRoom); - if (last_msg) { - linphone_chat_message_unref(last_msg); - linphone_chat_room_set_user_data(chatRoom, NULL); - } - FileTransferDelegate *ftdToDelete = nil; for (FileTransferDelegate *ftd in [LinphoneManager.instance fileTransferDelegates]) { if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) { diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 6a2b7a541..de7e1a8d7 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -1277,7 +1277,7 @@ static void linphone_iphone_message_received(LinphoneCore *lc, LinphoneChatRoom static void linphone_iphone_message_received_unable_decrypt(LinphoneCore *lc, LinphoneChatRoom *room, LinphoneChatMessage *message) { - NSString *msgId = [NSString stringWithUTF8String:linphone_chat_message_get_custom_header(message, "Call-ID")]; + NSString *msgId = [NSString stringWithUTF8String:linphone_chat_message_get_message_id(message)]; int index = [(NSNumber *)[LinphoneManager.instance.pushDict objectForKey:msgId] intValue] - 1; LOGI(@"Decrementing index of long running task for call id : %@ with index : %d", msgId, index); diff --git a/Classes/LinphoneUI/UIChatBubbleTextCell.m b/Classes/LinphoneUI/UIChatBubbleTextCell.m index bd110792b..1120a150f 100644 --- a/Classes/LinphoneUI/UIChatBubbleTextCell.m +++ b/Classes/LinphoneUI/UIChatBubbleTextCell.m @@ -84,16 +84,8 @@ return; } - if (_message) { - CFBridgingRelease(linphone_chat_message_get_user_data(_message)); - linphone_chat_message_set_user_data(_message, NULL); - linphone_chat_message_cbs_set_msg_state_changed(linphone_chat_message_get_callbacks(_message), NULL); - linphone_chat_message_unref(_message); - } - _message = amessage; if (amessage) { - linphone_chat_message_ref(_message); linphone_chat_message_set_user_data(_message, (void *)CFBridgingRetain(self)); LinphoneChatMessageCbs *cbs = linphone_chat_message_get_callbacks(_message); linphone_chat_message_cbs_set_msg_state_changed(cbs, message_status); diff --git a/Classes/LinphoneUI/UIChatCell.m b/Classes/LinphoneUI/UIChatCell.m index 0488bdba8..611987ace 100644 --- a/Classes/LinphoneUI/UIChatCell.m +++ b/Classes/LinphoneUI/UIChatCell.m @@ -91,7 +91,6 @@ _chatLatestTimeLabel.text = [LinphoneUtils timeToString:linphone_chat_message_get_time(last_msg) withFormat:LinphoneDateChatList]; _chatLatestTimeLabel.hidden = NO; - linphone_chat_message_unref(last_msg); linphone_chat_room_set_user_data(chatRoom, NULL); } else { _chatContentLabel.text = nil; diff --git a/submodules/linphone b/submodules/linphone index 41a4a3457..88e381ffb 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit 41a4a345704322e3ab67a4c96a0b111e21d4d97a +Subproject commit 88e381ffb2430d5b42d26e2380467edada352079