summaryrefslogtreecommitdiff
path: root/Userland/DevTools
diff options
context:
space:
mode:
authorLennon Donaghy <donaghylennon@gmail.com>2021-08-02 01:11:42 +0100
committerAndreas Kling <kling@serenityos.org>2021-08-22 10:30:06 +0200
commitff2a1ee8b0ef0369fe4ecc8988170b4971837331 (patch)
tree62e801e8541bbc083c7ba401beb455d180221dde /Userland/DevTools
parent971a5a70d1b08af149553abf84cf7bf353d37e63 (diff)
downloadserenity-ff2a1ee8b0ef0369fe4ecc8988170b4971837331.zip
HackStudio: Stop debugger when opening new project
Moved code to stop the debugger in the HackStudioWidget destructor to a new method so that this can be called in both the destructor and when opening a new project.
Diffstat (limited to 'Userland/DevTools')
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.cpp8
-rw-r--r--Userland/DevTools/HackStudio/HackStudioWidget.h1
2 files changed, 8 insertions, 1 deletions
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);