1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

Bug 295899 CVariables aren't removed when the underlying cdiObject is destroyed.

This commit is contained in:
James Blackburn 2009-11-24 12:46:35 +00:00
parent 99148105b3
commit 193a63fe4e
2 changed files with 17 additions and 11 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 QNX Software Systems and others.
* Copyright (c) 2004, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -155,16 +155,16 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
*/
protected void updateVariables() throws DebugException {
List locals = getAllCDIVariableObjects();
int index = 0;
while( index < fVariables.size() ) {
ICDIVariableDescriptor varObject = findVariable( locals, (CVariable)fVariables.get( index ) );
if ( varObject != null ) {
locals.remove( varObject );
index++;
}
Iterator<CVariable> it = fVariables.iterator();
while (it.hasNext()) {
CVariable var = it.next();
ICDIVariableDescriptor varObject = findVariable(locals, var);
if (varObject != null && !var.isDisposed())
locals.remove(varObject);
else {
// remove variable
fVariables.remove( index );
// ensure variable is unregistered from event listener
var.dispose();
it.remove();
}
}
// add any new locals

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2004, 2007 QNX Software Systems and others.
* Copyright (c) 2004, 2009 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -16,6 +16,7 @@ import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.core.ICDebugConstants;
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.event.ICDIMemoryChangedEvent;
@ -507,6 +508,11 @@ public abstract class CVariable extends AbstractCVariable implements ICDIEventLi
else if ( event instanceof ICDIResumedEvent ) {
handleResumedEvent( (ICDIResumedEvent)event );
}
else if (event instanceof ICDIDestroyedEvent
&& iv.getCdiObject() == source) {
dispose();
fireChangeEvent(DebugEvent.STATE);
}
}
}
}