Bug 207570 [ErrorHandling] NPE on shutdown in IDEWorkbenchErrorHandler
The UIJob in IDEWorkbenchErrorHandler gets an NPE when it shuts down after ann OutOfMemory exception. closeWorkbench() appears to be called after closing has started Thread [main] (Suspended (exception NullPointerException)) IDEWorkbenchErrorHandler.closeWorkbench() line: 236 IDEWorkbenchErrorHandler.handleException(Throwable) line: 140 IDEWorkbenchErrorHandler.access$0(IDEWorkbenchErrorHandler, Throwable) line: 131 IDEWorkbenchErrorHandler$1.runInUIThread(IProgressMonitor) line: 106 UIJob$1.run() line: 94 RunnableLock.run() line: 35 UISynchronizer(Synchronizer).runAsyncMessages(boolean) line: 124 Display.runAsyncMessages(boolean) line: 3721 Display.readAndDispatch() line: 3358 Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2395 Workbench.runUI() line: 2359 Workbench.access$4(Workbench) line: 2225 Workbench$4.run() line: 468 Realm.runWithDefault(Realm, Runnable) line: 288 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 463 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 106 EclipseAppHandle.run(Object) line: 193 EclipseAppLauncher.runApplication(Object) line: 106 EclipseAppLauncher.start(Object) line: 76 EclipseStarter.run(Object) line: 362 EclipseStarter.run(String[], Runnable) line: 175 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 Main.invokeFramework(String[], URL[]) line: 515 Main.basicRun(String[]) line: 455 Main.run(String[]) line: 1193 Main.main(String[]) line: 1169
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEWorkbenchErrorHandler.java
}
		
		if (isFatal(statusAdapter) && style != StatusManager.NONE) {
			UIJob handlingExceptionJob = new UIJob("IDE Exception Handler") 
			{
				/*
				 * (non-Javadoc)
				 * 
				 * @see org.eclipse.ui.progress.UIJob#runInUIThread(org.eclipse.core.runtime.IProgressMonitor)
				 */
				public IStatus runInUIThread(IProgressMonitor monitor) {
					handleException(statusAdapter.getStatus().getException());
					return new Status(
							IStatus.OK,
							IDEWorkbenchPlugin.IDE_WORKBENCH,
							IDEWorkbenchMessages.IDEExceptionHandler_ExceptionHandledMessage);
				}
			};
			handlingExceptionJob.setSystem(true);
			handlingExceptionJob.schedule();
		}
	}
	private boolean isFatal(final StatusAdapter statusAdapter) {
		if (statusAdapter.getStatus().getException() != null
				&& (statusAdapter.getStatus().getException() instanceof OutOfMemoryError
						|| statusAdapter.getStatus().getException() instanceof StackOverflowError
						|| statusAdapter.getStatus().getException() instanceof VirtualMachineError || statusAdapter
						.getStatus().getException() instanceof SWTError)) {
			return true;
		}