From 61647275e84d0a7c3216f86b383e3eb40588700e Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 20 May 2020 13:28:18 +0400 Subject: [PATCH] Optimize image destruction. No need to call _source->unload(), it leads to saving to PNG. --- Telegram/SourceFiles/ui/image/image.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/ui/image/image.cpp b/Telegram/SourceFiles/ui/image/image.cpp index 157f8e016..8b38382bf 100644 --- a/Telegram/SourceFiles/ui/image/image.cpp +++ b/Telegram/SourceFiles/ui/image/image.cpp @@ -1011,7 +1011,9 @@ void Image::invalidateSizeCache() const { Image::~Image() { if (this != Empty() && this != BlankMedia()) { - unload(); + invalidateSizeCache(); + ActiveCache().decrement(ComputeUsage(_data)); + _data = QImage(); ActiveCache().remove(this); } }