mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:07:34 +00:00
LibCore+Userland: Don't auto-start new Core::Timers
This was unintuitive, and only useful in a few cases. In the majority, users had to immediately call `stop()`, and several who did want the timer started would call `start()` on it immediately anyway. Case in point: There are only two places I had to add a manual `start()`.
This commit is contained in:
parent
a8cf0c9371
commit
6edc0cf5ab
10 changed files with 12 additions and 8 deletions
|
@ -132,6 +132,7 @@ NetworkStatisticsWidget::NetworkStatisticsWidget()
|
|||
1000, [this] {
|
||||
update_models();
|
||||
});
|
||||
m_update_timer->start();
|
||||
|
||||
update_models();
|
||||
};
|
||||
|
|
|
@ -110,6 +110,7 @@ ProcessMemoryMapWidget::ProcessMemoryMapWidget()
|
|||
|
||||
m_table_view->set_key_column_and_sort_order(0, GUI::SortOrder::Ascending);
|
||||
m_timer = add<Core::Timer>(1000, [this] { refresh(); });
|
||||
m_timer->start();
|
||||
}
|
||||
|
||||
void ProcessMemoryMapWidget::set_pid(pid_t pid)
|
||||
|
|
|
@ -82,8 +82,10 @@ ThreadStackWidget::ThreadStackWidget()
|
|||
void ThreadStackWidget::show_event(GUI::ShowEvent&)
|
||||
{
|
||||
refresh();
|
||||
if (!m_timer)
|
||||
if (!m_timer) {
|
||||
m_timer = add<Core::Timer>(1000, [this] { refresh(); });
|
||||
m_timer->start();
|
||||
}
|
||||
}
|
||||
|
||||
void ThreadStackWidget::hide_event(GUI::HideEvent&)
|
||||
|
|
|
@ -328,6 +328,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
};
|
||||
update_stats();
|
||||
auto& refresh_timer = window->add<Core::Timer>(frequency * 1000, move(update_stats));
|
||||
refresh_timer.start();
|
||||
|
||||
auto selected_id = [&](ProcessModel::Column column) -> pid_t {
|
||||
if (process_table_view.selection().is_empty())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue