mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Worker threads can try to evaluate expressions on the stack frames that have already been disposed. A flag is added to identify that the stack frame is disposed.
This commit is contained in:
parent
30c7c341a3
commit
0448368a27
2 changed files with 29 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2004-11-18 Mikhail Khodjaiants
|
||||
Worker threads can try to evaluate expressions on the stack frames that
|
||||
have already been disposed. A flag is added to identify that the stack
|
||||
frame is disposed.
|
||||
* CStackFrame.java
|
||||
|
||||
2004-11-19 Alain Magloire
|
||||
|
||||
Clear the confusion about sublist of stackframes.
|
||||
|
|
|
@ -79,6 +79,11 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
*/
|
||||
private List fExpressions;
|
||||
|
||||
/**
|
||||
* Need this flag to prevent evaluations on disposed frames.
|
||||
*/
|
||||
private boolean fIsDisposed = false;
|
||||
|
||||
/**
|
||||
* Constructor for CStackFrame.
|
||||
*/
|
||||
|
@ -477,6 +482,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
}
|
||||
|
||||
protected void dispose() {
|
||||
setDisposed( true );
|
||||
getCDISession().getEventManager().removeEventListener( this );
|
||||
disposeAllVariables();
|
||||
disposeExpressions();
|
||||
|
@ -661,9 +667,11 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
* @see org.eclipse.cdt.debug.core.model.ICStackFrame#evaluateExpression(java.lang.String)
|
||||
*/
|
||||
public IValue evaluateExpression( String expressionText ) throws DebugException {
|
||||
CExpression expression = getExpression( expressionText );
|
||||
if ( expression != null ) {
|
||||
return expression.getValue( this );
|
||||
if ( !isDisposed() ) {
|
||||
CExpression expression = getExpression( expressionText );
|
||||
if ( expression != null ) {
|
||||
return expression.getValue( this );
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -718,7 +726,10 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
}
|
||||
}
|
||||
|
||||
private CExpression getExpression( String expressionText ) throws DebugException {
|
||||
private synchronized CExpression getExpression( String expressionText ) throws DebugException {
|
||||
if ( isDisposed() ) {
|
||||
return null;
|
||||
}
|
||||
if ( fExpressions == null ) {
|
||||
fExpressions = new ArrayList( 5 );
|
||||
}
|
||||
|
@ -740,4 +751,12 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
|
|||
}
|
||||
return expression;
|
||||
}
|
||||
|
||||
protected boolean isDisposed() {
|
||||
return fIsDisposed;
|
||||
}
|
||||
|
||||
private synchronized void setDisposed( boolean isDisposed ) {
|
||||
fIsDisposed = isDisposed;
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue