1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +02:00

Fixed NPE's resulting from CDebugTarget now nulling out its CDI reference on cleanup.

This commit is contained in:
John Cortell 2008-07-29 21:31:11 +00:00
parent 18540abf27
commit d8aad9f2f0
2 changed files with 7 additions and 2 deletions

View file

@ -207,7 +207,8 @@ abstract public class CDebugElement extends PlatformObject implements ICDebugEle
* @return the CDI session * @return the CDI session
*/ */
public ICDISession getCDISession() { public ICDISession getCDISession() {
return getCDITarget().getSession(); final ICDITarget cdiTarget = getCDITarget();
return cdiTarget != null ? cdiTarget.getSession() : null;
} }
/** /**

View file

@ -15,6 +15,7 @@ import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
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;
@ -472,7 +473,10 @@ public class CMemoryBlockExtension extends CDebugElement implements IMemoryBlock
} }
fCDIBlock = null; fCDIBlock = null;
} }
getCDISession().getEventManager().removeEventListener( this ); final ICDISession cdiSession = getCDISession();
if (cdiSession != null) {
cdiSession.getEventManager().removeEventListener( this );
}
} }
/* (non-Javadoc) /* (non-Javadoc)