Bug 280000 NPE in UISchedulerStrategy
Build: I20090610 The following NPE occurs if a context is modified during shutdown: java.lang.NullPointerException at org.eclipse.e4.workbench.ui.internal.UISchedulerStrategy.schedule(UISchedulerStrategy.java:49) at org.eclipse.e4.core.services.internal.context.EclipseContext.schedule(EclipseContext.java:311) at org.eclipse.e4.core.services.internal.context.EclipseContext$TrackableComputation.doHandleInvalid(EclipseContext.java:95) at org.eclipse.e4.core.services.internal.context.Computation.handleInvalid(Computation.java:60) at org.eclipse.e4.core.services.internal.context.EclipseContext.invalidate(EclipseContext.java:262) at org.eclipse.e4.core.services.internal.context.EclipseContext.set(EclipseContext.java:323) at org.eclipse.e4.workbench.ui.renderers.PartFactory.activate(PartFactory.java:129) at org.eclipse.e4.workbench.ui.renderers.swt.StackModelFactory$5.handleEvent(StackModelFactory.java:302) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1008) at org.eclipse.swt.widgets.Shell.setActiveControl(Shell.java:1404) at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:2597) at org.eclipse.swt.widgets.Widget.wmSetFocus(Widget.java:2282) at org.eclipse.swt.widgets.Control.WM_SETFOCUS(Control.java:4573) at org.eclipse.swt.widgets.Control.windowProc(Control.java:4014) at org.eclipse.swt.widgets.Text.windowProc(Text.java:2170) at org.eclipse.swt.widgets.Display.windowProc(Display.java:4589) at org.eclipse.swt.internal.win32.OS.SetFocus(Native Method) at org.eclipse.swt.widgets.Control.forceFocus(Control.java:978) at org.eclipse.swt.widgets.Control.setFocus(Control.java:2965) at org.eclipse.ui.internal.views.log.LogView.setFocus(LogView.java:1080) at org.eclipse.ui.internal.views.log.LogView.onTextShellDispose(LogView.java:1302) at org.eclipse.ui.internal.views.log.LogView$28.widgetDisposed(LogView.java:1295) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:117) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1003) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1027) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1008) at org.eclipse.swt.widgets.Widget.release(Widget.java:804) at org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:1250) at org.eclipse.swt.widgets.Widget.release(Widget.java:807) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:441) at org.eclipse.swt.widgets.Decorations.dispose(Decorations.java:447) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:709) at org.eclipse.swt.widgets.Display.release(Display.java:3523) at org.eclipse.swt.graphics.Device.dispose(Device.java:293) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:129) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:194) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311)
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/internal/UISchedulerStrategy.java
private static final ISchedulerStrategy instance = new UISchedulerStrategy();
	/**
	 * Returns the singleton UI scheduler instance
	 * 
	 * @return the UI scheduler instance
	 */
	public static ISchedulerStrategy getInstance() {
		return instance;
	}
	public boolean schedule(final IEclipseContext context,
			final IRunAndTrack runnable, final String name,
			final int eventType, final Object[] args) {
		final boolean[] result = new boolean[1];
		Realm.getDefault().asyncExec(new Runnable() {
			public void run() {
				result[0] = runnable.notify(context, name, eventType, args);
			}
		});
		return result[0];
	}
	public void schedule(Runnable runnable) {
		Realm.getDefault().asyncExec(runnable);
	}
}