diff --git a/CHANGELOG.md b/CHANGELOG.md
index ac032203..1fd01100 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,6 +30,7 @@
- Bugfix: Fixed shared chat badges displaying pixelated when Chatterino is scaled too much. (#6146)
- Bugfix: Fixed a crash that could occur when eventsub was enabled and Chatterino was attached to a conhost on Windows that was later gone. (#6161)
- Bugfix: Fixed a crash that could occur an eventsub connection's keepalive timer would run after the connection was dead, causing the keepalive timer to use-itself-after-free. (#6204)
+- Bugfix: Fixed a crash that could occur when an image started loading mid app shutdown. (#6213)
- Bugfix: Fixed some minor typos. (#6196)
- Dev: Mini refactor of Split. (#6148)
- Dev: Conan will no longer generate a `CMakeUserPresets.json` file. (#6117)
diff --git a/src/Application.cpp b/src/Application.cpp
index 508443fc..1de04c43 100644
--- a/src/Application.cpp
+++ b/src/Application.cpp
@@ -2,7 +2,6 @@
#include "common/Args.hpp"
#include "common/Channel.hpp"
-#include "common/QLogging.hpp"
#include "common/Version.hpp"
#include "controllers/accounts/AccountController.hpp"
#include "controllers/commands/Command.hpp"
@@ -34,8 +33,6 @@
#include "providers/bttv/BttvLiveUpdates.hpp"
#include "providers/chatterino/ChatterinoBadges.hpp"
#include "providers/ffz/FfzBadges.hpp"
-#include "providers/seventv/eventapi/Dispatch.hpp"
-#include "providers/seventv/eventapi/Subscription.hpp"
#include "providers/seventv/SeventvBadges.hpp"
#include "providers/seventv/SeventvEventAPI.hpp"
#include "providers/twitch/ChannelPointReward.hpp"
diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp
index 60cbbfb4..8c2a8300 100644
--- a/src/messages/Image.cpp
+++ b/src/messages/Image.cpp
@@ -39,6 +39,14 @@ Frames::Frames(QList &&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 &&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 &&frames)
else
{
this->durationOffset_ = std::min(
- int(getApp()->getEmotes()->getGIFTimer().position() %
- totalLength),
+ int(app->getEmotes()->getGIFTimer().position() % totalLength),
60000);
}
this->processOffset();