Ensure that being added FileSource isn't copied.

This commit is contained in:
levlam 2023-02-28 14:35:52 +03:00
parent 3678343a06
commit 8b292e4f85
2 changed files with 3 additions and 3 deletions

View File

@ -83,7 +83,7 @@ FileSourceId FileReferenceManager::get_current_file_source_id() const {
}
template <class T>
FileSourceId FileReferenceManager::add_file_source_id(T source, Slice source_str) {
FileSourceId FileReferenceManager::add_file_source_id(T &source, Slice source_str) {
file_sources_.emplace_back(std::move(source));
VLOG(file_references) << "Create file source " << file_sources_.size() << " for " << source_str;
return get_current_file_source_id();
@ -102,7 +102,7 @@ FileSourceId FileReferenceManager::create_user_photo_file_source(UserId user_id,
FileSourceId FileReferenceManager::create_web_page_file_source(string url) {
FileSourceWebPage source{std::move(url)};
auto source_str = PSTRING() << "web page of " << source.url;
return add_file_source_id(std::move(source), source_str);
return add_file_source_id(source, source_str);
}
FileSourceId FileReferenceManager::create_saved_animations_file_source() {

View File

@ -186,7 +186,7 @@ class FileReferenceManager final : public Actor {
Destination on_query_result(Destination dest, FileSourceId file_source_id, Status status, int32 sub = 0);
template <class T>
FileSourceId add_file_source_id(T source, Slice source_str);
FileSourceId add_file_source_id(T &source, Slice source_str);
FileSourceId get_current_file_source_id() const;