mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-09-10 03:53:21 +02:00
Bug 295899 CVariables aren't removed when the underlying cdiObject is destroyed.
This commit is contained in:
parent
99148105b3
commit
193a63fe4e
2 changed files with 17 additions and 11 deletions
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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 {
|
protected void updateVariables() throws DebugException {
|
||||||
List locals = getAllCDIVariableObjects();
|
List locals = getAllCDIVariableObjects();
|
||||||
int index = 0;
|
Iterator<CVariable> it = fVariables.iterator();
|
||||||
while( index < fVariables.size() ) {
|
while (it.hasNext()) {
|
||||||
ICDIVariableDescriptor varObject = findVariable( locals, (CVariable)fVariables.get( index ) );
|
CVariable var = it.next();
|
||||||
if ( varObject != null ) {
|
ICDIVariableDescriptor varObject = findVariable(locals, var);
|
||||||
locals.remove( varObject );
|
if (varObject != null && !var.isDisposed())
|
||||||
index++;
|
locals.remove(varObject);
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
// remove variable
|
// ensure variable is unregistered from event listener
|
||||||
fVariables.remove( index );
|
var.dispose();
|
||||||
|
it.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// add any new locals
|
// add any new locals
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* 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.ICDTLaunchConfigurationConstants;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent;
|
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.ICDIEvent;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
|
||||||
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
|
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 ) {
|
else if ( event instanceof ICDIResumedEvent ) {
|
||||||
handleResumedEvent( (ICDIResumedEvent)event );
|
handleResumedEvent( (ICDIResumedEvent)event );
|
||||||
}
|
}
|
||||||
|
else if (event instanceof ICDIDestroyedEvent
|
||||||
|
&& iv.getCdiObject() == source) {
|
||||||
|
dispose();
|
||||||
|
fireChangeEvent(DebugEvent.STATE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue