SystemMonitor: Convert most widgets to a failable factory

I didn't convert widgets that don't do any failable tasks currently
or are lazy-initialized.
This commit is contained in:
Karol Kosek 2023-05-21 16:47:34 +02:00 committed by Andreas Kling
parent a5936864d9
commit 412630637a
Notes: sideshowbarker 2024-07-17 07:06:47 +09:00
10 changed files with 96 additions and 71 deletions

View file

@ -71,11 +71,13 @@ private:
Vector<Symbolication::Symbol> m_symbols;
};
ThreadStackWidget::ThreadStackWidget()
ErrorOr<NonnullRefPtr<ThreadStackWidget>> ThreadStackWidget::try_create()
{
set_layout<GUI::VerticalBoxLayout>(4);
m_stack_table = add<GUI::TableView>();
m_stack_table->set_model(adopt_ref(*new ThreadStackModel()));
auto widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ThreadStackWidget()));
TRY(widget->try_set_layout<GUI::VerticalBoxLayout>(4));
widget->m_stack_table = TRY(widget->try_add<GUI::TableView>());
widget->m_stack_table->set_model(TRY(try_make_ref_counted<ThreadStackModel>()));
return widget;
}
void ThreadStackWidget::show_event(GUI::ShowEvent&)