Fix crash that could occur when closing down the last of a channel when reloading emotes (#4278)

* Fix crash that could occur when a channel is closed

Ensure we copy the QString in case the channel goes out of scope and
we're referring to nothing

* Add changelog entry
This commit is contained in:
pajlada 2022-12-31 14:03:16 +01:00 committed by GitHub
parent 293aa370c5
commit f04c4c7388
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -18,7 +18,8 @@
- Bugfix: Fixed text sometimes not pasting properly when image uploader was disabled. (#4246) - Bugfix: Fixed text sometimes not pasting properly when image uploader was disabled. (#4246)
- Bugfix: Fixed text cursor(caret) not showing in open channel dialog. (#4196) - Bugfix: Fixed text cursor(caret) not showing in open channel dialog. (#4196)
- Bugfix: Fixed tooltip images not appearing if mouse hovered only first pixel. (#4268) - Bugfix: Fixed tooltip images not appearing if mouse hovered only first pixel. (#4268)
- Bugfix: Fixed crash that could occurr when closing down a split at the wrong time. (#4277) - Bugfix: Fixed crash that could occur when closing down a split at the wrong time. (#4277)
- Bugfix: Fixed crash that could occur when closing down the last of a channel when reloading emotes. (#4278)
- Dev: Remove protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256) - Dev: Remove protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256)
- Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) - Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198)
- Dev: Migrated to C++ 20 (#4252, #4257) - Dev: Migrated to C++ 20 (#4252, #4257)

View file

@ -169,8 +169,7 @@ void BttvEmotes::loadChannel(std::weak_ptr<Channel> channel,
{ {
NetworkRequest(QString(bttvChannelEmoteApiUrl) + channelId) NetworkRequest(QString(bttvChannelEmoteApiUrl) + channelId)
.timeout(20000) .timeout(20000)
.onSuccess([callback = std::move(callback), channel, .onSuccess([callback = std::move(callback), channel, channelDisplayName,
&channelDisplayName,
manualRefresh](auto result) -> Outcome { manualRefresh](auto result) -> Outcome {
auto pair = auto pair =
parseChannelEmotes(result.parseJson(), channelDisplayName); parseChannelEmotes(result.parseJson(), channelDisplayName);