Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow ChannelViews without a Split #4747

Merged
merged 23 commits into from
Dec 17, 2023

Conversation

Nerixyz
Copy link
Contributor

@Nerixyz Nerixyz commented Aug 3, 2023

Description

This PR changes the references to splits kept by ChannelViews, ReplyThreadPopups, and UserInfoPopups to be a QPointer<Split>. This way, they can't contain dangling pointers to the original Splits. In turn, the following UB and potential crashes are prevented:

  • Using Go to Message in a user card/reply thread popup after the original split has been deleted.
  • Sending messages in a reply thread after the original split has been deleted. (Try replacing the Split* in SplitInput with a QPointer<Split> if there's no crash)

This in turn makes it possible to create user cards and reply thread popups without a split. Also required for #4746.

@Nerixyz Nerixyz marked this pull request as ready for review August 3, 2023 12:27
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

src/widgets/dialogs/ReplyThreadPopup.cpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Outdated Show resolved Hide resolved
@Nerixyz Nerixyz mentioned this pull request Aug 16, 2023
13 tasks
@Nerixyz Nerixyz changed the title Use weak-references to Splits and allow them to be nullptr Allow ChannelViews without a Split Dec 17, 2023
Copy link
Member

@pajlada pajlada left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some small nitpicks, overall looks good 👍

src/widgets/splits/SplitInput.cpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.hpp Outdated Show resolved Hide resolved
src/widgets/helper/ChannelView.cpp Outdated Show resolved Hide resolved
@pajlada pajlada merged commit d105a68 into Chatterino:master Dec 17, 2023
20 checks passed
@Nerixyz Nerixyz deleted the fix/no-split-crash branch December 17, 2023 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants