Update FileManager.cpp
This commit is contained in:
parent
159ec55ecf
commit
54531202a8
@ -3841,7 +3841,6 @@ void FileManager::memory_cleanup() {
|
||||
std::vector<int32> file_to_be_deleted = {};
|
||||
|
||||
while (it != file_id_info_.end()) {
|
||||
if (it->second.node_id_ != 0) {
|
||||
auto find_node = file_nodes_.find(it->second.node_id_);
|
||||
if (find_node != file_nodes_.end()) {
|
||||
auto &node = find_node->second;
|
||||
@ -3892,10 +3891,6 @@ void FileManager::memory_cleanup() {
|
||||
/* The file has a nonexistent node associated */
|
||||
file_to_be_deleted.push_back(it->first);
|
||||
}
|
||||
} else {
|
||||
// todo: When the program starts there is a file that points to the node 0. It shouldn't happen but it happens, so don't delete it, maybe that file is used by tdlib for some reason.
|
||||
// file_to_be_deleted.push_back(it->first);
|
||||
}
|
||||
|
||||
it++;
|
||||
}
|
||||
@ -3944,7 +3939,9 @@ void FileManager::memory_cleanup() {
|
||||
if (it->second->main_file_id_.empty()) {
|
||||
is_invalid = true;
|
||||
} else {
|
||||
if (file_id_info_[it->second->main_file_id_.get()].node_id_ == 0) {
|
||||
auto find_file_id_info = file_id_info_.find(it->second->main_file_id_.get());
|
||||
if (find_file_id_info != file_id_info_.end()) {
|
||||
if (find_file_id_info->second.node_id_ == 0) {
|
||||
for (auto &file_id : it->second->file_ids_) {
|
||||
context_->destroy_file_source(file_id);
|
||||
file_id_info_.erase(file_id.get());
|
||||
@ -3952,6 +3949,10 @@ void FileManager::memory_cleanup() {
|
||||
file_id_info_.erase(it->second->main_file_id_.get());
|
||||
is_invalid = true;
|
||||
}
|
||||
} else {
|
||||
// todo: is it invalid or not here?
|
||||
is_invalid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user