diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.cpp b/Userland/DevTools/HackStudio/HackStudioWidget.cpp index b158cd950c..5ac37b27ec 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.cpp +++ b/Userland/DevTools/HackStudio/HackStudioWidget.cpp @@ -201,6 +201,7 @@ void HackStudioWidget::open_project(const String& root_path) add_new_editor(*m_editors_splitter); m_todo_entries_widget->clear(); m_terminal_wrapper->clear_including_history(); + stop_debugger_if_running(); } m_project = Project::open_with_root_path(root_path); VERIFY(m_project); @@ -1153,7 +1154,7 @@ void HackStudioWidget::handle_external_file_deletion(const String& filepath) close_file_in_all_editors(filepath); } -HackStudioWidget::~HackStudioWidget() +void HackStudioWidget::stop_debugger_if_running() { if (!m_debugger_thread.is_null()) { Debugger::the().stop(); @@ -1166,6 +1167,11 @@ HackStudioWidget::~HackStudioWidget() } } +HackStudioWidget::~HackStudioWidget() +{ + stop_debugger_if_running(); +} + HackStudioWidget::ContinueDecision HackStudioWidget::warn_unsaved_changes(const String& prompt) { if (!any_document_is_dirty()) diff --git a/Userland/DevTools/HackStudio/HackStudioWidget.h b/Userland/DevTools/HackStudio/HackStudioWidget.h index c6ddd85ea1..0ba6c42b38 100644 --- a/Userland/DevTools/HackStudio/HackStudioWidget.h +++ b/Userland/DevTools/HackStudio/HackStudioWidget.h @@ -103,6 +103,7 @@ private: void update_statusbar(); void handle_external_file_deletion(const String& filepath); + void stop_debugger_if_running(); void create_open_files_view(GUI::Widget& parent); void create_toolbar(GUI::Widget& parent);