From bd853de716e8b02860b15bd60100d62854ec443f Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Wed, 5 Jul 2023 01:34:33 +0200 Subject: [PATCH] Mail: Fix crash caused by migration from NonnullRefPtrVector When we moved from NonnullRefPtrVector to Vector> in commit 8a48246ed1a93983668a25f5b9b0af0e745e3f04, the `at()` function started returning a NonnullRefPtr& instead of T&. The code calling create_index() was not then updated and ended up taking a pointer to a temporary NonnullRefPtr<>, instead of an actual object, leading to a crash after logging in. --- Userland/Applications/Mail/MailboxTreeModel.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Applications/Mail/MailboxTreeModel.cpp b/Userland/Applications/Mail/MailboxTreeModel.cpp index 583021941e..ce263a4310 100644 --- a/Userland/Applications/Mail/MailboxTreeModel.cpp +++ b/Userland/Applications/Mail/MailboxTreeModel.cpp @@ -21,17 +21,17 @@ GUI::ModelIndex MailboxTreeModel::index(int row, int column, GUI::ModelIndex con if (!parent.is_valid()) { if (m_account_holder.accounts().is_empty()) return {}; - return create_index(row, column, &m_account_holder.accounts().at(row)); + return create_index(row, column, m_account_holder.accounts().at(row)); } auto& base_node = *static_cast(parent.internal_data()); if (is(base_node)) { auto& remote_mailbox = verify_cast(base_node); - return create_index(row, column, &remote_mailbox.children().at(row)); + return create_index(row, column, remote_mailbox.children().at(row)); } auto& remote_parent = verify_cast(base_node); - return create_index(row, column, &remote_parent.mailboxes().at(row)); + return create_index(row, column, remote_parent.mailboxes().at(row)); } GUI::ModelIndex MailboxTreeModel::parent_index(GUI::ModelIndex const& index) const