chatterino2
chatterino2 copied to clipboard
Blocking a user through usercard then quickly closing it crashes the application
This happens somewhere in src/widgets/dialogs/UserInfoPopup.cpp:473
lines 473, 519, basically this
used in that context is no longer present.
I suspect that this could happen in many other places which use NetworkRequest and can be deleted, this
becomes an invalid pointer and SEGFAULT. We actually have a solution for this: NetworkRequest::caller(const QObject *parent)
:
/// NetworkRequest makes sure that the `caller` object still exists when the
/// callbacks are executed. Cannot be used with concurrent() since we can't
/// make sure that the object doesn't get deleted while the callback is
/// running.
This will be solved when I refactor Helix
to use a NetworkRequest
-like builder :)
This bug is also reproducible on chatterino7 builds (and any related forks) when Show 7TV Animated Profile Picture
is enabled, as opposed to it relating specifically to blocking.
Imo the issue title should be renamed to reflect the issue more accurately, and for easier discoverability.
Event viewer says: Faulting module name: ntdll.dll
Demo: https://i.alienpls.org/DFe.apng
usercard debug logs
chatterino.http: "GET 200 https://api.ivr.fi/twitch/subage/brian6932/brian6932"
chatterino.twitch: [TwitchChannel "brian6932" ] Opened
chatterino.twitch: [TwitchChannel "brian6932" ] Send message: ""
chatterino.http: "GET 200 https://api.twitch.tv/helix/users?login=brian6932"
chatterino.http: "GET 200 https://api.7tv.app/v2/users/brian6932"
chatterino.http: "GET 200 https://api.twitch.tv/helix/users/follows?to_id=84180052"
As zneix mentioned in his initial error report, the callbacks that come back from helix contains a raw pointer to the UserCard without holding a proper reference to it. We'd want to use shared_from_this
and pass along:
- a weak pointer to the UserInfoPopup so we can call
reenableBlockCheckbox
- a shared_pointer to the channel (so just pass along
this->channel_
) so we know where to send the error/success message - the username as a QString
[weak = this->shared_from_this(), channel = this->channel_, userName = this->userName_]
Block https://github.com/Chatterino/chatterino2/blob/c6ebb70e05c4b8c4b220498afde17846c7874ba9/src/widgets/dialogs/UserInfoPopup.cpp#L553-L568 Unblock https://github.com/Chatterino/chatterino2/blob/c6ebb70e05c4b8c4b220498afde17846c7874ba9/src/widgets/dialogs/UserInfoPopup.cpp#L580-L595
This bug is also reproducible on chatterino7 builds (and any related forks) when Show 7TV Animated Profile Picture is enabled, as opposed to it relating specifically to blocking.
That is a 7tv bug. Not our code.
Fixed in https://github.com/Chatterino/chatterino2/pull/4711