Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-debug-dev] NullPointerException when exiting eclipse while debug session active

Hi Mikhail,

I've run into a bunch of NPEs like the one below when users exit eclipse before a CDT debug session has terminated. I'm wondering if there' a better fix than just checking for null-pointers throughout. Should we shut down the event manager to prevent notification when the user exits?

The launch config no longer exists at this point. This is on CDT v3.0.2.

java.lang.NullPointerException

at org.eclipse.cdt.debug.internal.core.CGlobalVariableManager.save(CGlobalVariableManager.java:260) at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.saveGlobalVariables(CDebugTarget.java:1348) at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.cleanup(CDebugTarget.java:936) at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.terminated(CDebugTarget.java:902) at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.handleExitedEvent(CDebugTarget.java:1117) at org.eclipse.cdt.debug.internal.core.model.CDebugTarget.handleDebugEvents(CDebugTarget.java:814) at com.coware.scdt.debug.mi.core.cdi.EventManager.fireEvents(Unknown Source)
   at com.coware.scdt.debug.mi.core.cdi.EventManager.update(Unknown Source)
   at java.util.Observable.notifyObservers(Unknown Source)
at com.coware.scdt.debug.mi.core.MISession.notifyObservers(Unknown Source)
   at com.coware.scdt.debug.mi.core.EventThread.run(Unknown Source)

CGlobalVariableManager.save():

   public void save() {
ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration();
       try {
           ILaunchConfigurationWorkingCopy wc = config.getWorkingCopy();
wc.setAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_GLOBAL_VARIABLES, getMemento() );
           wc.doSave();
       }
       catch( CoreException e ) {
           DebugPlugin.log( e );
       }
   }

Cheers
Matthias

PS. Here's another example:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=126128




Back to the top