Fix color @usernames sometimes not working at all (#3170)
Definitely memory fuckery involved - The comment from @lubieerror https://github.com/Chatterino/chatterino2/issues/2822#issuecomment-897252673 is finally what led me to adding tests and hopefully fixing this.
This commit is contained in:
@@ -74,6 +74,12 @@ void ChannelChatters::updateOnlineChatters(
|
||||
chatters_->updateOnlineChatters(chatters);
|
||||
}
|
||||
|
||||
size_t ChannelChatters::colorsSize() const
|
||||
{
|
||||
auto size = this->chatterColors_.access()->size();
|
||||
return size;
|
||||
}
|
||||
|
||||
const QColor ChannelChatters::getUserColor(const QString &user)
|
||||
{
|
||||
const auto chatterColors = this->chatterColors_.access();
|
||||
|
||||
@@ -25,9 +25,13 @@ public:
|
||||
void setUserColor(const QString &user, const QColor &color);
|
||||
void updateOnlineChatters(const std::unordered_set<QString> &chatters);
|
||||
|
||||
private:
|
||||
// colorsSize returns the amount of colors stored in `chatterColors_`
|
||||
// NOTE: This function is only meant to be used in tests and benchmarks
|
||||
size_t colorsSize() const;
|
||||
|
||||
static constexpr int maxChatterColorCount = 5000;
|
||||
|
||||
private:
|
||||
Channel &channel_;
|
||||
|
||||
// maps 2 char prefix to set of names
|
||||
|
||||
Reference in New Issue
Block a user