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:
pajlada
2021-08-21 12:38:38 +02:00
committed by GitHub
parent 07454d0537
commit d7fd08b1d6
6 changed files with 128 additions and 1 deletions
+6
View File
@@ -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();
+5 -1
View File
@@ -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