1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

Fixed 254514. Expression-values not being disposed of.

This commit is contained in:
John Cortell 2008-11-06 21:04:40 +00:00
parent 31a7ae9a20
commit fa2d511bbd

View file

@ -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;
}