From 31c1bb815701bd89891749f77e343221a80fa139 Mon Sep 17 00:00:00 2001 From: Ricardo Subtil Date: Wed, 21 Jan 2026 14:37:32 +0000 Subject: [PATCH] Silently stop all script debuggers if no debugging server is active MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Krzysztof BiegaƄski --- editor/debugger/editor_debugger_node.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/editor/debugger/editor_debugger_node.cpp b/editor/debugger/editor_debugger_node.cpp index 8b3a65ca03..691c833baa 100644 --- a/editor/debugger/editor_debugger_node.cpp +++ b/editor/debugger/editor_debugger_node.cpp @@ -313,6 +313,17 @@ void EditorDebuggerNode::stop(bool p_force) { inspect_edited_object_wait = false; current_uri.clear(); + // Also close all debugging sessions. + _for_all(tabs, [&](ScriptEditorDebugger *dbg) { + // If the server is also still active, let the debugger notify that it stopped. + // Otherwise, just stop it silently. + if (server.is_valid() || dbg->is_session_active()) { + dbg->_stop_and_notify(); + } else { + dbg->stop(); + } + }); + if (server.is_valid()) { server->stop(); EditorNode::get_log()->add_message("--- Debugging process stopped ---", EditorLog::MSG_TYPE_EDITOR); @@ -325,12 +336,6 @@ void EditorDebuggerNode::stop(bool p_force) { server.unref(); } - // Also close all debugging sessions. - _for_all(tabs, [&](ScriptEditorDebugger *dbg) { - if (dbg->is_session_active()) { - dbg->_stop_and_notify(); - } - }); _break_state_changed(); breakpoints.clear(); EditorUndoRedoManager::get_singleton()->clear_history(EditorUndoRedoManager::REMOTE_HISTORY, false);