From fa2d511bbdec3e97d0ca52361f2af45702a1d4e8 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Thu, 6 Nov 2008 21:04:40 +0000 Subject: [PATCH] Fixed 254514. Expression-values not being disposed of. --- .../debug/internal/core/model/CExpression.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 206bf765e46..c4aa0e9def0 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 @@ -180,6 +180,21 @@ public class CExpression extends CLocalVariable implements IExpression { protected void resetValue() { if ( fValue instanceof AbstractCValue ) { ((AbstractCValue)fValue).reset(); + + // We can't just reset the value and toss the reference we've been + // holding. Those things have a dispose() method and that needs to be + // called when there is no further use for it (so debugger-engine + // objects tied to the value can be freed). We return the AbstractCValue + // as an IValue to the platform, which means the platform certainly + // isn't going to dispose of it (there is no IValue.dispose method). + // Notice that we call AbstractCValue.dispose in our dispose method + // above. So, naturally, we need to do the same here. But then what is + // the purpose of calling AbstractCValue.reset() if we just dispose of + // the object, anyway? This whole thing seems a bit screwy. We should + // either be holding on to the AbstractCValue and resetting it, or just + // discarding it. The reset above doesn't hurt, but it sure seems + // pointless. + ((AbstractCValue) fValue).dispose(); } fValue = CValueFactory.NULL_VALUE; }