|
@@ -33,6 +33,8 @@
|
|
#include "jni_utils.h"
|
|
#include "jni_utils.h"
|
|
|
|
|
|
#ifdef TOOLS_ENABLED
|
|
#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 "editor/run/editor_run_bar.h"
|
|
#include "main/main.h"
|
|
#include "main/main.h"
|
|
#endif
|
|
#endif
|
|
@@ -53,6 +55,17 @@ JNIEXPORT void JNICALL Java_org_godotengine_godot_editor_utils_EditorUtils_runSc
|
|
|
|
|
|
EditorRunBar *editor_run_bar = EditorRunBar::get_singleton();
|
|
EditorRunBar *editor_run_bar = EditorRunBar::get_singleton();
|
|
if (editor_run_bar != nullptr) {
|
|
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()) {
|
|
if (scene.is_empty()) {
|
|
editor_run_bar->play_main_scene(false);
|
|
editor_run_bar->play_main_scene(false);
|
|
} else {
|
|
} else {
|