mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:27:42 +00:00
HackStudio: Fix event loop usage in debugger callbacks
These callbacks are called from a different thread than the UI thread, so we need to explicitly use the Application's event loop to perform GUI logic.
This commit is contained in:
parent
ff6fb2cb10
commit
58c4fe52d4
1 changed files with 6 additions and 6 deletions
|
@ -1050,7 +1050,7 @@ void HackStudioWidget::initialize_debugger()
|
||||||
}
|
}
|
||||||
dbgln("Debugger stopped at source position: {}:{}", source_position.value().file_path, source_position.value().line_number);
|
dbgln("Debugger stopped at source position: {}:{}", source_position.value().file_path, source_position.value().line_number);
|
||||||
|
|
||||||
deferred_invoke([this, source_position, ®s] {
|
GUI::Application::the()->event_loop().deferred_invoke([this, source_position, ®s] {
|
||||||
m_current_editor_in_execution = get_editor_of_file(source_position.value().file_path);
|
m_current_editor_in_execution = get_editor_of_file(source_position.value().file_path);
|
||||||
if (m_current_editor_in_execution)
|
if (m_current_editor_in_execution)
|
||||||
m_current_editor_in_execution->editor().set_execution_position(source_position.value().line_number - 1);
|
m_current_editor_in_execution->editor().set_execution_position(source_position.value().line_number - 1);
|
||||||
|
@ -1059,20 +1059,20 @@ void HackStudioWidget::initialize_debugger()
|
||||||
m_disassembly_widget->update_state(*Debugger::the().session(), regs);
|
m_disassembly_widget->update_state(*Debugger::the().session(), regs);
|
||||||
HackStudioWidget::reveal_action_tab(*m_debug_info_widget);
|
HackStudioWidget::reveal_action_tab(*m_debug_info_widget);
|
||||||
});
|
});
|
||||||
Core::EventLoop::wake_current();
|
GUI::Application::the()->event_loop().wake();
|
||||||
|
|
||||||
return Debugger::HasControlPassedToUser::Yes;
|
return Debugger::HasControlPassedToUser::Yes;
|
||||||
},
|
},
|
||||||
[this]() {
|
[this]() {
|
||||||
deferred_invoke([this] {
|
GUI::Application::the()->event_loop().deferred_invoke([this] {
|
||||||
m_debug_info_widget->set_debug_actions_enabled(false);
|
m_debug_info_widget->set_debug_actions_enabled(false);
|
||||||
if (m_current_editor_in_execution)
|
if (m_current_editor_in_execution)
|
||||||
m_current_editor_in_execution->editor().clear_execution_position();
|
m_current_editor_in_execution->editor().clear_execution_position();
|
||||||
});
|
});
|
||||||
Core::EventLoop::wake_current();
|
GUI::Application::the()->event_loop().wake();
|
||||||
},
|
},
|
||||||
[this]() {
|
[this]() {
|
||||||
deferred_invoke([this] {
|
GUI::Application::the()->event_loop().deferred_invoke([this] {
|
||||||
m_debug_info_widget->set_debug_actions_enabled(false);
|
m_debug_info_widget->set_debug_actions_enabled(false);
|
||||||
if (m_current_editor_in_execution)
|
if (m_current_editor_in_execution)
|
||||||
m_current_editor_in_execution->editor().clear_execution_position();
|
m_current_editor_in_execution->editor().clear_execution_position();
|
||||||
|
@ -1089,7 +1089,7 @@ void HackStudioWidget::initialize_debugger()
|
||||||
HackStudioWidget::hide_action_tabs();
|
HackStudioWidget::hide_action_tabs();
|
||||||
GUI::MessageBox::show(window(), "Program Exited"sv, "Debugger"sv, GUI::MessageBox::Type::Information);
|
GUI::MessageBox::show(window(), "Program Exited"sv, "Debugger"sv, GUI::MessageBox::Type::Information);
|
||||||
});
|
});
|
||||||
Core::EventLoop::wake_current();
|
GUI::Application::the()->event_loop().wake();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue