From aa3f10c491dc568d2263cfdaf194ebb1509fbf6a Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Tue, 24 Jun 2003 05:30:41 +0000 Subject: [PATCH] All local var_objects are destroyed when a thread other than current is selected. CVariable has to be invalidated if a "destroyed" event has been received. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 5 +++ .../debug/internal/core/model/CVariable.java | 35 +++++++++++++++---- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 022fb398753..705d128e8d8 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,8 @@ +2003-06-24 Mikhail Khodjaiants + All local var_objects are destroyed when a thread other than current is selected. + CVariable has to be invalidated if a "destroyed" event has been received. + * CVariable.java + 2003-06-23 Mikhail Khodjaiants Fix for ClassCastException in CStackFrame. * CStackFrame.java 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 caae2886616..13cdfb9e74b 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 @@ -13,6 +13,7 @@ import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIFormat; import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; +import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgumentObject; @@ -104,6 +105,11 @@ public abstract class CVariable extends CDebugElement invalidate(); setCDIVariableObject( null ); } + + protected boolean isSameVariable( ICDIVariable cdiVar ) + { + return ( fCDIVariable != null ) ? fCDIVariable.equals( cdiVar ) : false; + } } /** @@ -371,16 +377,16 @@ public abstract class CVariable extends CDebugElement { if ( event instanceof ICDIChangedEvent ) { - try + if ( source instanceof ICDIVariable && isSameVariable( (ICDIVariable)source ) ) { - if ( source instanceof ICDIVariable && source.equals( getCDIVariable() ) ) - { - handleChangedEvent( (ICDIChangedEvent)event ); - } + handleChangedEvent( (ICDIChangedEvent)event ); } - catch( CDIException e ) + } + else if ( event instanceof ICDIDestroyedEvent ) + { + if ( source instanceof ICDIVariable && isSameVariable( (ICDIVariable)source ) ) { - // do nothing + handleDestroyedEvent( (ICDIDestroyedEvent)event ); } } } @@ -399,6 +405,15 @@ public abstract class CVariable extends CDebugElement } } + private void handleDestroyedEvent( ICDIDestroyedEvent event ) + { + if ( fOriginal != null ) + fOriginal.invalidate(); + if ( getShadow() != null ) + getShadow().invalidate(); + invalidateValue(); + } + /** * Returns the stack frame this variable is contained in. * @@ -830,4 +845,10 @@ public abstract class CVariable extends CDebugElement { return ( getParent() instanceof CStackFrame ); } + + protected boolean isSameVariable( ICDIVariable cdiVar ) + { + return ( ( getShadow() != null && getShadow().isSameVariable( cdiVar ) ) || + ( fOriginal != null && fOriginal.isSameVariable( cdiVar ) ) ); + } }