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

Don't hold session pointer in Data::CloudImage.

This commit is contained in:
John Preston
2020-05-28 17:51:18 +04:00
parent 29a498b959
commit 249f7813c1
11 changed files with 81 additions and 53 deletions

View File

@@ -3030,17 +3030,18 @@ not_null<Data::CloudImage*> Session::location(const LocationPoint &point) {
if (i != _locations.cend()) {
return i->second.get();
}
const auto result = _locations.emplace(
point,
std::make_unique<Data::CloudImage>(_session)).first->second.get();
const auto location = Data::ComputeLocation(point);
result->set(ImageWithLocation{
const auto prepared = ImageWithLocation{
.location = ImageLocation(
{ location },
location.width,
location.height)
});
return result;
};
return _locations.emplace(
point,
std::make_unique<Data::CloudImage>(
_session,
prepared)).first->second.get();
}
void Session::registerPhotoItem(