Made need_delete_message_files const.

GitOrigin-RevId: b547551f6968766447e448c00c0bd65333316886
This commit is contained in:
levlam 2019-04-29 06:21:43 +03:00
parent a33a620fd1
commit b49e312389
2 changed files with 5 additions and 4 deletions

View File

@ -23149,7 +23149,7 @@ bool MessagesManager::need_delete_file(FullMessageId full_message_id, FileId fil
return true;
}
bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) {
bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) const {
CHECK(d != nullptr);
if (m == nullptr || !m->message_id.is_server()) {
return false;
@ -23157,8 +23157,9 @@ bool MessagesManager::need_delete_message_files(Dialog *d, const Message *m) {
if (m->forward_info != nullptr && m->forward_info->from_dialog_id.is_valid() &&
m->forward_info->from_message_id.is_valid()) {
const Message *old_m = get_message_force({m->forward_info->from_dialog_id, m->forward_info->from_message_id},
"need_delete_message_files");
// this function must not try to load the message, because it can be called from
// do_delete_message or add_message_to_dialog
const Message *old_m = get_message({m->forward_info->from_dialog_id, m->forward_info->from_message_id});
if (old_m != nullptr && get_message_file_ids(old_m) == get_message_file_ids(m)) {
return false;
}

View File

@ -1560,7 +1560,7 @@ class MessagesManager : public Actor {
bool need_delete_file(FullMessageId full_message_id, FileId file_id) const;
bool need_delete_message_files(Dialog *d, const Message *m);
bool need_delete_message_files(Dialog *d, const Message *m) const;
void add_message_to_database(const Dialog *d, const Message *m, const char *source);