From 980811a75cf2abb93b742be7c0e4a1788bfd5994 Mon Sep 17 00:00:00 2001 From: Gautier Pelloux-Prayer Date: Wed, 2 Sep 2015 14:34:46 +0200 Subject: [PATCH] chat: fix crash when file transfer was aborted due to some error in liblinphone --- Classes/Utils/FileTransferDelegate.m | 13 +++++++------ submodules/linphone | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Classes/Utils/FileTransferDelegate.m b/Classes/Utils/FileTransferDelegate.m index 112c62b9b..5775125ac 100644 --- a/Classes/Utils/FileTransferDelegate.m +++ b/Classes/Utils/FileTransferDelegate.m @@ -137,19 +137,20 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m } - (void)upload:(UIImage *)image withURL:(NSURL *)url forChatRoom:(LinphoneChatRoom *)chatRoom { - [[[LinphoneManager instance] fileTransferDelegates] addObject:self]; + [LinphoneManager.instance.fileTransferDelegates addObject:self]; LinphoneContent *content = linphone_core_create_content(linphone_chat_room_get_lc(chatRoom)); _data = [NSMutableData dataWithData:UIImageJPEGRepresentation(image, 1.0)]; linphone_content_set_type(content, "image"); linphone_content_set_subtype(content, "jpeg"); linphone_content_set_name(content, - [[NSString stringWithFormat:@"%li-%f.jpg", (long)[image hash], + [[NSString stringWithFormat:@"%li-%f.jpg", (long)image.hash, [NSDate timeIntervalSinceReferenceDate]] UTF8String]); - linphone_content_set_size(content, [_data length]); + linphone_content_set_size(content, _data.length); _message = linphone_chat_room_create_file_transfer_message(chatRoom, content); - linphone_chat_message_ref(_message); + linphone_content_unref(content); + linphone_chat_message_cbs_set_file_transfer_send(linphone_chat_message_get_callbacks(_message), linphone_iphone_file_transfer_send); @@ -158,7 +159,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m [LinphoneManager setValueInMessageAppData:[url absoluteString] forKey:@"localimage" inMessage:_message]; } - LOGI(@"%p Uploading content in %p", self, _message); + LOGI(@"%p Uploading content from message %p", self, _message); linphone_chat_room_send_chat_message(chatRoom, _message); } @@ -193,7 +194,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m linphone_chat_message_cancel_file_transfer(_message); linphone_chat_message_unref(_message); } - _message = nil; + _message = NULL; _data = nil; LOGI(@"%p Destroying", self); } diff --git a/submodules/linphone b/submodules/linphone index a722c7651..434907917 160000 --- a/submodules/linphone +++ b/submodules/linphone @@ -1 +1 @@ -Subproject commit a722c765153c7f0065ccca1137c7b4d97294477f +Subproject commit 434907917e933737b31b93853019f3a8c7300675