diff --git a/Telegram/SourceFiles/data/data_media_types.cpp b/Telegram/SourceFiles/data/data_media_types.cpp index 27a14077f8..0f05b969a4 100644 --- a/Telegram/SourceFiles/data/data_media_types.cpp +++ b/Telegram/SourceFiles/data/data_media_types.cpp @@ -38,6 +38,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_channel.h" #include "lang/lang_keys.h" #include "layout.h" +#include "storage/file_upload.h" namespace Data { namespace { @@ -262,6 +263,9 @@ MediaPhoto::MediaPhoto( } MediaPhoto::~MediaPhoto() { + if (uploading() && !App::quitting()) { + parent()->history()->session().uploader().cancel(parent()->fullId()); + } parent()->history()->owner().unregisterPhotoItem(_photo, parent()); } @@ -499,6 +503,9 @@ MediaFile::MediaFile( } MediaFile::~MediaFile() { + if (uploading() && !App::quitting()) { + parent()->history()->session().uploader().cancel(parent()->fullId()); + } parent()->history()->owner().unregisterDocumentItem( _document, parent()); diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index db49104683..930bbcbd18 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -767,9 +767,6 @@ void HistoryItem::drawInDialog( HistoryItem::~HistoryItem() { _history->owner().notifyItemRemoved(this); App::historyUnregItem(this); - if (id < 0 && !App::quitting()) { - _history->session().uploader().cancel(fullId()); - } } QDateTime ItemDateTime(not_null item) {