1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:28:11 +00:00

IRCClient: Use NonnullRefPtr<IRCClient> throughout

To protect against mishaps during app exit teardown, make sure everyone
who needs to be is a co-owner of the IRCClient object.

Fixes #3451.
This commit is contained in:
Andreas Kling 2020-09-10 18:42:26 +02:00
parent 039e529dbe
commit 4e0df06f86
6 changed files with 35 additions and 35 deletions

View file

@ -39,7 +39,7 @@ IRCWindowListModel::~IRCWindowListModel()
int IRCWindowListModel::row_count(const GUI::ModelIndex&) const
{
return m_client.window_count();
return m_client->window_count();
}
int IRCWindowListModel::column_count(const GUI::ModelIndex&) const
@ -63,7 +63,7 @@ GUI::Variant IRCWindowListModel::data(const GUI::ModelIndex& index, GUI::ModelRo
if (role == GUI::ModelRole::Display) {
switch (index.column()) {
case Column::Name: {
auto& window = m_client.window_at(index.row());
auto& window = m_client->window_at(index.row());
if (window.unread_count())
return String::format("%s (%d)", window.name().characters(), window.unread_count());
return window.name();
@ -73,7 +73,7 @@ GUI::Variant IRCWindowListModel::data(const GUI::ModelIndex& index, GUI::ModelRo
if (role == GUI::ModelRole::ForegroundColor) {
switch (index.column()) {
case Column::Name: {
auto& window = m_client.window_at(index.row());
auto& window = m_client->window_at(index.row());
if (window.unread_count())
return Color(Color::Red);
if (!window.channel().is_open())