From d7166fae9fb44f38b730e622823d6846ea347257 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 2 Mar 2025 18:27:18 +0100 Subject: [PATCH] fix: try to avoid crash on image load when app is exiting (#6018) --- CHANGELOG.md | 1 + mocks/include/mocks/Helix.hpp | 1 + src/messages/Image.cpp | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 15c002a9..9b55aec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Bugfix: Fixed a potential way to escape the Lua Plugin sandbox. (#5846) - Bugfix: Fixed a crash relating to Lua HTTP. (#5800) - Bugfix: Fixed a crash that could occur on Linux and macOS when clicking "Install" from the update prompt. (#5818) +- Bugfix: Fixed a crash related to image loading that could occur when closing Chatterino. (#6018) - Bugfix: Fixed missing word wrap in update popup. (#5811) - Bugfix: Fixed tabs not scaling to the default scale when changing the scale from a non-default value. (#5794) - Bugfix: Closing a usercard will no longer cause stop-logging messages to be generated in channel logs. (#5828) diff --git a/mocks/include/mocks/Helix.hpp b/mocks/include/mocks/Helix.hpp index 3c55d3dd..d042743b 100644 --- a/mocks/include/mocks/Helix.hpp +++ b/mocks/include/mocks/Helix.hpp @@ -7,6 +7,7 @@ #include #include +#include #include namespace chatterino::mock { diff --git a/src/messages/Image.cpp b/src/messages/Image.cpp index 59be1995..60cbbfb4 100644 --- a/src/messages/Image.cpp +++ b/src/messages/Image.cpp @@ -245,7 +245,11 @@ void assignFrames(std::weak_ptr weak, QList parsed) isPushQueued = true; postToThread([] { isPushQueued = false; - getApp()->getWindows()->forceLayoutChannelViews(); + auto *app = tryGetApp(); + if (app != nullptr) + { + app->getWindows()->forceLayoutChannelViews(); + } }); } };