forked from mirrors/linphone-iphone
FileTransfer: fix crash when deleting a chat room with pending transfers
This commit is contained in:
parent
a4db6e8793
commit
62b6669c1a
4 changed files with 19 additions and 5 deletions
|
|
@ -194,7 +194,6 @@
|
|||
[tableView beginUpdates];
|
||||
LinphoneChatMessage *chat = ms_list_nth_data(self->messageList, (int)[indexPath row]);
|
||||
if( chat ){
|
||||
|
||||
linphone_chat_room_delete_message(chatRoom, chat);
|
||||
messageList = ms_list_remove(messageList, chat);
|
||||
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@
|
|||
#import "ChatTableViewController.h"
|
||||
#import "UIChatCell.h"
|
||||
|
||||
#import "FileTransferDelegate.h"
|
||||
|
||||
#import "linphone/linphonecore.h"
|
||||
#import "PhoneMainView.h"
|
||||
#import "UACellBackgroundView.h"
|
||||
|
|
@ -171,8 +173,14 @@ static void chatTable_free_chatrooms(void *data){
|
|||
linphone_chat_message_unref(last_msg);
|
||||
linphone_chat_room_set_user_data(chatRoom, NULL);
|
||||
}
|
||||
linphone_chat_room_delete_history(chatRoom);
|
||||
linphone_chat_room_unref(chatRoom);
|
||||
|
||||
for (FileTransferDelegate *ftd in [[LinphoneManager instance] fileTransferDelegates]) {
|
||||
if (linphone_chat_message_get_chat_room(ftd.message) == chatRoom) {
|
||||
[ftd cancel];
|
||||
}
|
||||
}
|
||||
linphone_chat_room_delete_history(chatRoom);
|
||||
linphone_chat_room_unref(chatRoom);
|
||||
data = ms_list_remove(data, chatRoom);
|
||||
|
||||
// will force a call to [self loadData]
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ static void linphone_iphone_file_transfer_recv(LinphoneChatMessage *message, con
|
|||
CFRelease((__bridge CFTypeRef)thiz);
|
||||
}];
|
||||
} else {
|
||||
LOGI(@"Transfer of %s (%d bytes): already %ld sent, adding %ld", linphone_content_get_name(content),
|
||||
LOGD(@"Transfer of %s (%d bytes): already %ld sent, adding %ld", linphone_content_get_name(content),
|
||||
linphone_content_get_size(content), [thiz.data length], size);
|
||||
[thiz.data appendBytes:linphone_buffer_get_string_content(buffer) length:size];
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
|
|
@ -97,7 +97,7 @@ static LinphoneBuffer *linphone_iphone_file_transfer_send(LinphoneChatMessage *m
|
|||
@"state" : @(linphone_chat_message_get_state(message)),
|
||||
@"progress" : @(offset * 1.f / total),
|
||||
}];
|
||||
LOGI(@"Transfer of %s (%d bytes): already sent %ld, remaining %ld", linphone_content_get_name(content), total,
|
||||
LOGD(@"Transfer of %s (%d bytes): already sent %ld, remaining %ld", linphone_content_get_name(content), total,
|
||||
offset, remaining);
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kLinphoneFileTransferSendUpdate
|
||||
object:thiz
|
||||
|
|
|
|||
|
|
@ -211,6 +211,13 @@
|
|||
|
||||
- (void)downloadImage {
|
||||
[self uploadImage];
|
||||
// wait for the upload to terminate...
|
||||
for (int i = 0; i < 15; i++) {
|
||||
[tester waitForTimeInterval:1.f];
|
||||
if ([[[LinphoneManager instance] fileTransferDelegates] count] == 0)
|
||||
break;
|
||||
}
|
||||
[tester waitForViewWithAccessibilityLabel:LOCALIZED(@"Download")];
|
||||
[tester tapViewWithAccessibilityLabel:LOCALIZED(@"Download")];
|
||||
[tester waitForTimeInterval:.5f]; // just wait a few secs to start download
|
||||
XCTAssertEqual([[[LinphoneManager instance] fileTransferDelegates] count], 1);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue