1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 16:35:06 +00:00

SystemMonitor: Don't generate backtraces while not looking at them

This commit is contained in:
Andreas Kling 2021-04-05 11:29:18 +02:00
parent 3bb36dbd3f
commit cbc582e0df
2 changed files with 15 additions and 3 deletions

View file

@ -37,21 +37,30 @@ ThreadStackWidget::ThreadStackWidget()
layout()->set_margins({ 4, 4, 4, 4 }); layout()->set_margins({ 4, 4, 4, 4 });
m_stack_editor = add<GUI::TextEditor>(); m_stack_editor = add<GUI::TextEditor>();
m_stack_editor->set_mode(GUI::TextEditor::ReadOnly); m_stack_editor->set_mode(GUI::TextEditor::ReadOnly);
m_timer = add<Core::Timer>(1000, [this] { refresh(); });
} }
ThreadStackWidget::~ThreadStackWidget() ThreadStackWidget::~ThreadStackWidget()
{ {
} }
void ThreadStackWidget::show_event(GUI::ShowEvent&)
{
refresh();
if (!m_timer)
m_timer = add<Core::Timer>(1000, [this] { refresh(); });
}
void ThreadStackWidget::hide_event(GUI::HideEvent&)
{
m_timer = nullptr;
}
void ThreadStackWidget::set_ids(pid_t pid, pid_t tid) void ThreadStackWidget::set_ids(pid_t pid, pid_t tid)
{ {
if (m_pid == pid && m_tid == tid) if (m_pid == pid && m_tid == tid)
return; return;
m_pid = pid; m_pid = pid;
m_tid = tid; m_tid = tid;
refresh();
} }
void ThreadStackWidget::refresh() void ThreadStackWidget::refresh()

View file

@ -40,6 +40,9 @@ public:
private: private:
ThreadStackWidget(); ThreadStackWidget();
virtual void show_event(GUI::ShowEvent&) override;
virtual void hide_event(GUI::HideEvent&) override;
pid_t m_pid { -1 }; pid_t m_pid { -1 };
pid_t m_tid { -1 }; pid_t m_tid { -1 };
RefPtr<GUI::TextEditor> m_stack_editor; RefPtr<GUI::TextEditor> m_stack_editor;