Remove unused variables, Refactor in MessageLayout #4520
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull request checklist:
CHANGELOG.md
was updated, if applicableNo changelog entry needed in my opinion
Description
layoutCount_
andbufferUpdatedCount_
debug counters to anifdef
block inMessageLayout
MessageLayout::collapsedHeight_
std::shared_ptr<MessageLayoutContainer> container_
withMessageLayoutContainer container_
inMessageLayout
shared_ptr
std::shared_ptr<QPixmap> buffer_
withstd::unique_ptr<QPixmap> buffer_
inMessageLayout
unique_ptr
insteadMessageLayout::ensureBuffer
Why? While scrolling on a debug build, my Chatterino crashed with the following stack trace:
Ostensibly caused by the
MessageLayoutContainer
in theMessageLayout
being null. I suppose this could be caused by a race condition in which the destructor was in progress and the layout container had been deleted, but not the layout? Not sure. Regardless, while investigating, I noticed that theMessageLayoutContainer
didn't need to be a pointer at all. I also noticed the other few things that I included in this PR.Feel free to say that this doesn't matter/shouldn't be changed. Though, I think extracting the debug counters to an
ifdef
and removing the unused variable should be a change made anyway.