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
return false;
	}
	private void handleException(Throwable t) {
		try {
			exceptionCount++;
			if (exceptionCount > 1) {
				dialog.updateMessage(MessageFormat.format(MSG_FATAL_ERROR,
						new Object[] { MSG_FATAL_ERROR_Recursive }));
				dialog.getShell().forceActive();
			} else {
				if (openQuestionDialog(t)) {
					closeWorkbench();
				}
			}
		} finally {
			exceptionCount--;
		}
	}
	/**
	 * Informs the user about a fatal error. Returns true if the user decide to
	 * exit workbench or if another fatal error happens while reporting it.
	 */
	private boolean openQuestionDialog(Throwable t) {
		try {
			String msg = null;
			if (t instanceof OutOfMemoryError) {
				msg = MSG_OutOfMemoryError;
			} else if (t instanceof StackOverflowError) {
				msg = MSG_StackOverflowError;
			} else if (t instanceof VirtualMachineError) {