From 03f812787528c25fb09e52d3a2db2910aced5b0c Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 9 Mar 2023 09:43:13 +0400 Subject: [PATCH] Fix huge memory allocation on unused emoji. Before that change call to Instance::setColored started emoji loading and allocating memory for all animation frames even if it wasn't used. --- ui/text/custom_emoji_instance.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui/text/custom_emoji_instance.cpp b/ui/text/custom_emoji_instance.cpp index 96b8395..aa98a72 100644 --- a/ui/text/custom_emoji_instance.cpp +++ b/ui/text/custom_emoji_instance.cpp @@ -706,7 +706,9 @@ bool Instance::ready() { if (state.hasImagePreview()) { return true; } - load(state); + if (!_usage.empty()) { + load(state); + } return false; }, [](Caching &state) { return state.renderer->canMakePreview();