Skip to content

Commit c999058

Browse files
SougandhSmerks
authored andcommitted
Fix ReevaluateExpression enabled state on session termination
selectionChanged() now checks whether the debug target is terminated or disconnected before enabling the action, preventing stale re-evaluate actions from being invocable after the debug session has ended.
1 parent a7c593a commit c999058

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/actions/expressions/ReevaluateWatchExpressionAction.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2000, 2013 IBM Corporation and others.
2+
* Copyright (c) 2000, 2026 IBM Corporation and others.
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -20,6 +20,7 @@
2020
import org.eclipse.core.runtime.IAdaptable;
2121
import org.eclipse.debug.core.ILaunch;
2222
import org.eclipse.debug.core.model.IDebugElement;
23+
import org.eclipse.debug.core.model.IDebugTarget;
2324
import org.eclipse.debug.core.model.IWatchExpression;
2425
import org.eclipse.debug.internal.ui.DebugUIPlugin;
2526
import org.eclipse.debug.ui.DebugUITools;
@@ -88,6 +89,11 @@ public void selectionChanged(IAction action, ISelection selection) {
8889
if (debugElement == null) {
8990
action.setEnabled(false);
9091
} else {
92+
IDebugTarget debugTarget = debugElement.getDebugTarget();
93+
if (debugTarget.isDisconnected() || debugTarget.isTerminated()) {
94+
action.setEnabled(false);
95+
return;
96+
}
9197
action.setEnabled(true);
9298
}
9399
}

0 commit comments

Comments
 (0)