2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 06:55:58 +00:00

Don't unload all media on switching between chats.

This commit is contained in:
John Preston
2018-10-23 16:57:43 +04:00
parent 959859f57c
commit 8e7117fa22
21 changed files with 61 additions and 83 deletions

View File

@@ -42,7 +42,7 @@ int64 ComputeUsage(const QImage &image) {
Core::MediaActiveCache<const Image> &ActiveCache() {
static auto Instance = Core::MediaActiveCache<const Image>(
kMemoryForCache,
[](const Image *image) { image->forget(); });
[](const Image *image) { image->unload(); });
return Instance;
}
@@ -769,9 +769,9 @@ void Image::checkSource() const {
ActiveCache().up(this);
}
void Image::forget() const {
void Image::unload() const {
_source->takeLoaded();
_source->forget();
_source->unload();
invalidateSizeCache();
ActiveCache().decrement(ComputeUsage(_data));
_data = QImage();
@@ -800,6 +800,6 @@ void Image::invalidateSizeCache() const {
}
Image::~Image() {
forget();
unload();
ActiveCache().remove(this);
}