chatgui: fix all animations showing the same TGS (rlottie model cache key collision)

lottie_animation_from_data uses 'key' as a cache key for parsed models.
All LottieIcon instances were created with key="", causing rlottie's
model cache to return the first loaded animation for all subsequent
requests. Only visible on Windows where rlottie cache is enabled by
default.

Fix: pass unique animPath as key to each LottieIcon constructor.
Also replaced fprintf(stderr) diag with GUI_INFO logging via
AnimTimer::logRegisteredIcons() in debug_ui.h.
This commit is contained in:
Evgeny committed 2026-07-26 15:18:59 +03:00
1 parent 49da899964
commit 0e11d858e8
7 files changed
+23 -22

No files matched your search

+11 -1
View File
@@ -1,6 +1,6 @@
#include "animtimer.h"
#include "lottieicon.h"
#include "../../lib/debug_config.h"
#include "debug_ui.h"
AnimTimer::AnimTimer() {
m_timer.setInterval(33);
@@ -49,3 +49,13 @@ void AnimTimer::onTimer() {
icon->advanceFrame();
emit ticked();
}
void AnimTimer::logRegisteredIcons() const {
for (auto it = m_icons.constBegin(); it != m_icons.constEnd(); ++it) {
LottieIcon *icon = it.value();
GUI_INFO("LottieIcon: path=%s frames=%d size=%dx%d tgsSize=%d valid=%d",
qPrintable(it.key()), icon->frameCount(),
icon->originalSize().width(), icon->originalSize().height(),
icon->tgsSize(), (int)icon->isValid());
}
}