From 60cf97726ff8067a8df88454169aa870e3d25302 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 28 Aug 2020 13:02:41 +0200 Subject: [PATCH] Spreadsheet: Don't store help window's widgets in raw pointers We can just use RefPtr for these and lighten the cognitive burden. --- Applications/Spreadsheet/HelpWindow.cpp | 9 ++++----- Applications/Spreadsheet/HelpWindow.h | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Applications/Spreadsheet/HelpWindow.cpp b/Applications/Spreadsheet/HelpWindow.cpp index 0e77343455..df70436cd1 100644 --- a/Applications/Spreadsheet/HelpWindow.cpp +++ b/Applications/Spreadsheet/HelpWindow.cpp @@ -91,13 +91,12 @@ HelpWindow::HelpWindow(GUI::Window* parent) left_frame.set_layout().set_margins({ 0, 0, 0, 0 }); left_frame.set_preferred_size(100, 0); left_frame.set_size_policy(GUI::SizePolicy::Fixed, GUI::SizePolicy::Fill); - auto& list_view = left_frame.add(); - m_listview = &list_view; - list_view.set_model(HelpListModel::create()); + m_listview = left_frame.add(); + m_listview->set_model(HelpListModel::create()); - m_webview = &splitter.add(); + m_webview = splitter.add(); - list_view.on_activation = [this](auto& index) { + m_listview->on_activation = [this](auto& index) { if (!m_webview) return; diff --git a/Applications/Spreadsheet/HelpWindow.h b/Applications/Spreadsheet/HelpWindow.h index 32a2276f5e..7a29e12ecb 100644 --- a/Applications/Spreadsheet/HelpWindow.h +++ b/Applications/Spreadsheet/HelpWindow.h @@ -55,8 +55,8 @@ private: HelpWindow(GUI::Window* parent = nullptr); JsonObject m_docs; - Web::OutOfProcessWebView* m_webview { nullptr }; - GUI::ListView* m_listview { nullptr }; + RefPtr m_webview; + RefPtr m_listview; }; }