2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Stop playing documents when items are deleted.

This commit is contained in:
John Preston
2020-10-23 15:22:38 +03:00
parent 47bb8ec687
commit 3d54a263b8
8 changed files with 49 additions and 4 deletions

View File

@@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_channel.h"
#include "data/data_chat.h"
#include "data/data_user.h"
#include "data/data_document.h"
#include "data/data_histories.h"
#include "lang/lang_keys.h"
#include "apiwrap.h"
@@ -423,6 +424,11 @@ void History::destroyMessage(not_null<HistoryItem*> item) {
session().api().cancelLocalItem(item);
}
const auto document = [&] {
const auto media = item->media();
return media ? media->document() : nullptr;
}();
owner().unregisterMessage(item);
Core::App().notifications().clearFromItem(item);
@@ -432,6 +438,10 @@ void History::destroyMessage(not_null<HistoryItem*> item) {
Assert(i != end(_messages));
_messages.erase(i);
if (document) {
session().data().documentMessageRemoved(document);
}
}
not_null<HistoryItem*> History::addNewItem(