From d5a0e947ff56fad0e0382ea734c245df3474b69b Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Wed, 24 Nov 2004 20:46:06 +0000 Subject: [PATCH] Do not request to dispose local variables when the target is resumed. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 6 +++ .../internal/core/model/CExpression.java | 2 +- .../internal/core/model/CGlobalVariable.java | 7 ++++ .../debug/internal/core/model/CVariable.java | 37 +++++++++++-------- 4 files changed, 35 insertions(+), 17 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 7cc600aed7e..a0174667d2d 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,9 @@ +2004-11-24 Mikhail Khodjaiants + Do not request to dispose local variables when the target is resumed. + * CExpression.java + * CGlobalVariable.java + * CVariable.java + 2004-11-23 Mikhail Khodjaiants The enablement of the step actions is calculated in the UI thread. This causes the UI locks for slow or unresponsive targets. Use the cached stack frames to 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 aab30eba8ea..708b1c1917f 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 @@ -179,7 +179,7 @@ public class CExpression extends CVariable implements IExpression { ((AbstractCValue)fValue).dispose(); fValue = null; } - super.dispose(); + internalDispose( true ); } /* (non-Javadoc) 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 69c7bf64dda..334fc5f77d0 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 @@ -73,4 +73,11 @@ public class CGlobalVariable extends CVariable implements ICGlobalVariable { public IGlobalVariableDescriptor getDescriptor() { return fDescriptor; } + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose() + */ + public void dispose() { + internalDispose( true ); + } } \ No newline at end of file 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 275fcdf38b4..349494176df 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 @@ -167,9 +167,9 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { return fType; } - synchronized void invalidate() { + synchronized void invalidate( boolean destroy ) { try { - if ( fCDIVariable != null ) + if ( destroy && fCDIVariable != null ) fCDIVariable.dispose(); } catch( CDIException e ) { @@ -182,8 +182,8 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { fType = null; } - void dispose() { - invalidate(); + void dispose( boolean destroy ) { + invalidate( destroy ); } boolean isSameVariable( ICDIVariable cdiVar ) { @@ -389,10 +389,10 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { public void setEnabled( boolean enabled ) throws DebugException { InternalVariable iv = getOriginal(); if ( iv != null ) - iv.invalidate(); + iv.dispose( true ); iv = getShadow(); if ( iv != null ) - iv.invalidate(); + iv.dispose( true ); fIsEnabled = enabled; fireChangeEvent( DebugEvent.STATE ); } @@ -520,7 +520,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { if ( current != null ) { InternalVariable newVar = current.createShadow( startIndex, length ); if ( getShadow() != null ) - getShadow().dispose(); + getShadow().dispose( true ); setShadow( newVar ); fireChangeEvent( DebugEvent.STATE ); } @@ -609,7 +609,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { if ( current != null ) { InternalVariable newVar = current.createShadow( type ); if ( getShadow() != null ) - getShadow().dispose(); + getShadow().dispose( true ); setShadow( newVar ); fireChangeEvent( DebugEvent.STATE ); } @@ -624,7 +624,7 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { InternalVariable oldVar = getShadow(); setShadow( null ); if ( oldVar != null ) - oldVar.dispose(); + oldVar.dispose( true ); InternalVariable iv = getOriginal(); if ( iv != null ) iv.invalidateValue(); @@ -755,13 +755,8 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { * @see org.eclipse.cdt.debug.internal.core.model.AbstractCVariable#dispose() */ public void dispose() { - getCDISession().getEventManager().removeEventListener( this ); - InternalVariable iv = getOriginal(); - if ( iv != null ) - iv.dispose(); - iv = getShadow(); - if ( iv != null ) - iv.dispose(); + // Hack: do not destroy local variables + internalDispose( false ); } protected int sizeof() { @@ -807,4 +802,14 @@ public class CVariable extends AbstractCVariable implements ICDIEventListener { if ( iv != null ) iv.preserve(); } + + protected void internalDispose( boolean destroy ) { + getCDISession().getEventManager().removeEventListener( this ); + InternalVariable iv = getOriginal(); + if ( iv != null ) + iv.dispose( destroy ); + iv = getShadow(); + if ( iv != null ) + iv.dispose( destroy ); + } } \ No newline at end of file