You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Fix debugger immediate disconnect
Address https://github.com/godotengine/godot/issues/108518
This commit is contained in:
@@ -311,7 +311,9 @@ void EditorDebuggerNode::stop(bool p_force) {
|
||||
|
||||
// Also close all debugging sessions.
|
||||
_for_all(tabs, [&](ScriptEditorDebugger *dbg) {
|
||||
if (dbg->is_session_active()) {
|
||||
dbg->_stop_and_notify();
|
||||
}
|
||||
});
|
||||
_break_state_changed();
|
||||
breakpoints.clear();
|
||||
|
||||
@@ -33,6 +33,8 @@
|
||||
#include "jni_utils.h"
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
#include "editor/debugger/editor_debugger_node.h"
|
||||
#include "editor/debugger/script_editor_debugger.h"
|
||||
#include "editor/run/editor_run_bar.h"
|
||||
#include "main/main.h"
|
||||
#endif
|
||||
@@ -53,6 +55,17 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_EditorUtils_runSc
|
||||
|
||||
EditorRunBar *editor_run_bar = EditorRunBar::get_singleton();
|
||||
if (editor_run_bar != nullptr) {
|
||||
editor_run_bar->stop_playing();
|
||||
// Ensure that all ScriptEditorDebugger instances are explicitly stopped.
|
||||
// If not, a closing instance from the previous run session will trigger `_stop_and_notify()`, in turn causing
|
||||
// the closure of the ScriptEditorDebugger instances of the run session we're about to launch.
|
||||
EditorDebuggerNode *dbg_node = EditorDebuggerNode::get_singleton();
|
||||
if (dbg_node != nullptr) {
|
||||
for (int i = 0; ScriptEditorDebugger *dbg = dbg_node->get_debugger(i); i++) {
|
||||
dbg->stop();
|
||||
}
|
||||
}
|
||||
|
||||
if (scene.is_empty()) {
|
||||
editor_run_bar->play_main_scene(false);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user