fix: don't construct images after we're quitting (#6213)

This commit is contained in:
pajlada
2025-05-17 12:47:51 +02:00
committed by GitHub
parent 85866dc7a3
commit 46f3299a25
3 changed files with 11 additions and 6 deletions
+10 -3
View File
@@ -39,6 +39,14 @@ Frames::Frames(QList<Frame> &&frames)
: items_(std::move(frames))
{
assertInGuiThread();
auto *app = tryGetApp();
if (app == nullptr)
{
qCDebug(chatterinoImage)
<< "Frames constructor called while app is shutting down";
return;
}
DebugCount::increase("images");
if (!this->empty())
{
@@ -50,7 +58,7 @@ Frames::Frames(QList<Frame> &&frames)
DebugCount::increase("animated images");
this->gifTimerConnection_ =
getApp()->getEmotes()->getGIFTimer().signal.connect([this] {
app->getEmotes()->getGIFTimer().signal.connect([this] {
this->advance();
});
@@ -67,8 +75,7 @@ Frames::Frames(QList<Frame> &&frames)
else
{
this->durationOffset_ = std::min<int>(
int(getApp()->getEmotes()->getGIFTimer().position() %
totalLength),
int(app->getEmotes()->getGIFTimer().position() % totalLength),
60000);
}
this->processOffset();