From 1ab3d62bec4f21fe5ec96f3910308f56a8e09450 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Fri, 12 Dec 2025 19:30:32 +1000 Subject: [PATCH] clear threads and variables on stop --- .../Tab/SubTabs/ThreadsVariablesSubTab.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs index 0b8afbc..554aa8f 100644 --- a/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs +++ b/src/SharpIDE.Godot/Features/Debug_/Tab/SubTabs/ThreadsVariablesSubTab.cs @@ -28,8 +28,25 @@ public partial class ThreadsVariablesSubTab : Control GlobalEvents.Instance.DebuggerExecutionStopped.Subscribe(OnDebuggerExecutionStopped); _threadsTree.ItemSelected += OnThreadSelected; _stackFramesTree.ItemSelected += OnStackFrameSelected; + Project.ProjectStoppedRunning.Subscribe(ProjectStoppedRunning); } - + + public override void _ExitTree() + { + GlobalEvents.Instance.DebuggerExecutionStopped.Unsubscribe(OnDebuggerExecutionStopped); + Project.ProjectStoppedRunning.Unsubscribe(ProjectStoppedRunning); + } + + private async Task ProjectStoppedRunning() + { + await this.InvokeAsync(() => + { + _threadsTree.Clear(); + _stackFramesTree.Clear(); + _variablesTree.Clear(); + }); + } + private async void OnThreadSelected() { var selectedItem = _threadsTree.GetSelected();