diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index d805812be20..282f5ea0e43 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,10 @@ +2005-07-11 Mikhail Khodjaiants + Bug 102077: The DebugLabelViewDecorato asking info out of context. + Added a new flag to CVariable indicate the disposed state and prevent target requests. + * CExpression.java + * CGlobalVariable.java + * CVariable.java + 2005-07-11 Mikhail Khodjaiants Bug 102563: Break points not working. Temporary switching back to use file names instead of full paths. diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java index a2d1c8a3493..46a3459d316 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CExpression.java @@ -183,12 +183,15 @@ public class CExpression extends CVariable implements IExpression { fValue = CValueFactory.NULL_VALUE; } internalDispose( true ); + setDisposed( true ); } /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICVariable#getType() */ public ICType getType() throws DebugException { + if ( isDisposed() ) + return null; if ( fType == null ) { synchronized( this ) { if ( fType == null ) { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java index c2b65884dbb..cd64543e08b 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java @@ -79,5 +79,6 @@ public class CGlobalVariable extends CVariable implements ICGlobalVariable { */ public void dispose() { internalDispose( true ); + setDisposed( true ); } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java index 74be331cc2f..3addeb30fed 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java @@ -129,7 +129,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { } private ICDIVariableDescriptor getCDIVariableObject() { - if (fCDIVariable != null) { + if ( fCDIVariable != null ) { return fCDIVariable; } return fCDIVariableObject; @@ -349,6 +349,11 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { */ private CVariableFormat fFormat = CVariableFormat.getFormat( CDebugCorePlugin.getDefault().getPluginPreferences().getInt( ICDebugConstants.PREF_DEFAULT_VARIABLE_FORMAT ) ); + /** + * Whether this variable has been disposed. + */ + private boolean fIsDisposed = false; + /** * Constructor for CVariable. */ @@ -382,6 +387,8 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { * @see org.eclipse.cdt.debug.core.model.ICVariable#getType() */ public ICType getType() throws DebugException { + if ( isDisposed() ) + return null; InternalVariable iv = getCurrentInternalVariable(); return ( iv != null ) ? iv.getType() : null; } @@ -436,7 +443,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { * @see org.eclipse.debug.core.model.IVariable#getValue() */ public IValue getValue() throws DebugException { - if ( isEnabled() ) { + if ( !isDisposed() && isEnabled() ) { InternalVariable iv = getCurrentInternalVariable(); if ( iv != null ) { try { @@ -475,6 +482,8 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { * @see org.eclipse.debug.core.model.IVariable#hasValueChanged() */ public boolean hasValueChanged() throws DebugException { + if ( isDisposed() ) + return false; InternalVariable iv = getCurrentInternalVariable(); return ( iv != null ) ? iv.isChanged() : false; } @@ -782,6 +791,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { public void dispose() { // Hack: do not destroy local variables internalDispose( false ); + setDisposed( true ); } protected int sizeof() { @@ -837,4 +847,12 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { if ( iv != null ) iv.dispose( destroy ); } + + protected boolean isDisposed() { + return fIsDisposed; + } + + protected void setDisposed( boolean isDisposed ) { + fIsDisposed = isDisposed; + } }