Prevent crash when detaching freed debugger

This commit is contained in:
kobewi
2026-06-03 15:43:02 +02:00
parent 3badc0ee23
commit aa5f5054e2
2 changed files with 3 additions and 1 deletions
+2 -1
View File
@@ -109,7 +109,7 @@ void EditorDebuggerSession::set_breakpoint(const String &p_path, int p_line, boo
}
void EditorDebuggerSession::detach_debugger() {
if (!debugger) {
if (!debugger || !ObjectDB::get_instance(debugger_id)) {
return;
}
debugger->disconnect("started", callable_mp(this, &EditorDebuggerSession::_started));
@@ -125,6 +125,7 @@ void EditorDebuggerSession::detach_debugger() {
EditorDebuggerSession::EditorDebuggerSession(ScriptEditorDebugger *p_debugger) {
ERR_FAIL_NULL(p_debugger);
debugger = p_debugger;
debugger_id = p_debugger->get_instance_id();
debugger->connect("started", callable_mp(this, &EditorDebuggerSession::_started));
debugger->connect("stopped", callable_mp(this, &EditorDebuggerSession::_stopped));
debugger->connect("breaked", callable_mp(this, &EditorDebuggerSession::_breaked));