stop pending file transfers when entering linphone_core_destroy().

This commit is contained in:
Simon Morlat 2017-02-06 11:44:49 +01:00
parent 4849ca2e35
commit 1121e07313
2 changed files with 9 additions and 3 deletions

View file

@ -44,6 +44,7 @@ static void linphone_chat_room_delete_remote_composing_refresh_timer(LinphoneCha
static void _linphone_chat_message_destroy(LinphoneChatMessage *msg);
static void linphone_chat_room_notify_is_composing(LinphoneChatRoom *cr, const char *text);
static void linphone_chat_room_notify_imdn(LinphoneChatRoom *cr, const char *text);
static void linphone_chat_message_deactivate(LinphoneChatMessage *msg);
BELLE_SIP_DECLARE_NO_IMPLEMENTED_INTERFACES(LinphoneChatMessageCbs);
@ -310,6 +311,7 @@ void linphone_chat_room_release(LinphoneChatRoom *cr) {
linphone_chat_room_delete_composing_idle_timer(cr);
linphone_chat_room_delete_composing_refresh_timer(cr);
linphone_chat_room_delete_remote_composing_refresh_timer(cr);
bctbx_list_for_each(cr->weak_messages, (bctbx_list_iterate_func)linphone_chat_message_deactivate);
cr->lc = NULL;
linphone_chat_room_unref(cr);
}
@ -1619,12 +1621,16 @@ void linphone_chat_message_unref(LinphoneChatMessage *msg) {
belle_sip_object_unref(msg);
}
static void linphone_chat_message_release(LinphoneChatMessage *msg) {
/*mark the chat msg as orphan (it has no chat room anymore), and unref it*/
static void linphone_chat_message_deactivate(LinphoneChatMessage *msg){
/*mark the chat msg as orphan (it has no chat room anymore)*/
msg->chat_room = NULL;
if (msg->file_transfer_information != NULL) {
linphone_chat_message_cancel_file_transfer(msg);
}
}
static void linphone_chat_message_release(LinphoneChatMessage *msg) {
linphone_chat_message_deactivate(msg);
linphone_chat_message_unref(msg);
}

View file

@ -78,7 +78,7 @@ static void linphone_chat_message_process_auth_requested_download(void *data, be
static void linphone_chat_message_file_transfer_on_progress(belle_sip_body_handler_t *bh, belle_sip_message_t *m,
void *data, size_t offset, size_t total) {
LinphoneChatMessage *msg = (LinphoneChatMessage *)data;
if (msg->http_request && !file_transfer_in_progress_and_valid(msg)) {
if (!file_transfer_in_progress_and_valid(msg)) {
ms_warning("Cancelled request for %s msg [%p], ignoring %s", msg->chat_room?"":"ORPHAN", msg, __FUNCTION__);
_release_http_request(msg);
return;