Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 308194

Summary: [Compatibility] Uninjection failure in SelectionService makes compatibility layer unusable
Product: [Eclipse Project] e4 Reporter: Remy Suen <remy.suen>
Component: UIAssignee: Oleg Besedin <ob1.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: blocker    
Priority: P3 CC: ob1.eclipse
Version: 1.0   
Target Milestone: 1.0 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Patch none

Description Remy Suen CLA 2010-04-06 09:14:16 EDT
1. Open a file.
2. Open another file.
3. Close the second one.
4. Close the first one.
5. Exception are logged.
6. Alt+Tab to look at them.
7. Alt+Tab back. You will then get an infinite NPE dialog popup loop.

Uninjection failed for the object "org.eclipse.ui.internal.e4.compatibility.SelectionService@2f282f28". Unable to execute "org.eclipse.e4.core.internal.di.MethodRequestor@5cbe5cbe"
org.eclipse.e4.core.di.InjectionException
	at org.eclipse.e4.core.internal.di.InjectorImpl.logError(InjectorImpl.java:823)
	at org.eclipse.e4.core.internal.di.InjectorImpl.uninject(InjectorImpl.java:169)
	at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:389)
	at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.notify(ContextObjectSupplier.java:57)
	at org.eclipse.e4.core.internal.contexts.EclipseContext$TrackableComputationExt.notify(EclipseContext.java:169)
	at org.eclipse.e4.core.internal.contexts.EclipseContext$TrackableComputationExt.doHandleInvalid(EclipseContext.java:138)
	at org.eclipse.e4.core.internal.contexts.Computation.handleInvalid(Computation.java:62)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:326)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.removeGui(PartRenderingEngine.java:443)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$1.handleEvent(PartRenderingEngine.java:99)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:75)
	at org.eclipse.e4.workbench.ui.internal.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
	at org.eclipse.e4.ui.model.application.impl.PartImpl.setToBeRendered(PartImpl.java:508)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.hidePart(PartServiceImpl.java:516)
	at org.eclipse.e4.workbench.ui.renderers.swt.StackRenderer$6.close(StackRenderer.java:448)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1578)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:261)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4039)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3630)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$5.run(PartRenderingEngine.java:568)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.run(PartRenderingEngine.java:492)
	at org.eclipse.e4.workbench.ui.internal.E4Workbench.createAndRunUI(E4Workbench.java:101)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:526)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:512)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Unable to call pre-destory method "preDestroy"
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.e4.core.internal.di.MethodRequestor.callMethod(MethodRequestor.java:60)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:33)
	at org.eclipse.e4.core.internal.di.InjectorImpl.processPreDestory(InjectorImpl.java:415)
	at org.eclipse.e4.core.internal.di.InjectorImpl.disposed(InjectorImpl.java:388)
	at org.eclipse.e4.core.internal.contexts.ContextObjectSupplier$ContextInjectionListener.notify(ContextObjectSupplier.java:57)
	at org.eclipse.e4.core.internal.contexts.EclipseContext$TrackableComputationExt.notify(EclipseContext.java:169)
	at org.eclipse.e4.core.internal.contexts.EclipseContext$TrackableComputationExt.doHandleInvalid(EclipseContext.java:138)
	at org.eclipse.e4.core.internal.contexts.Computation.handleInvalid(Computation.java:62)
	at org.eclipse.e4.core.internal.contexts.EclipseContext.dispose(EclipseContext.java:326)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.removeGui(PartRenderingEngine.java:443)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$1.handleEvent(PartRenderingEngine.java:99)
	at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39)
	at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:75)
	at org.eclipse.e4.workbench.ui.internal.UIEventPublisher.notifyChanged(UIEventPublisher.java:60)
	at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:380)
	at org.eclipse.e4.ui.model.application.impl.PartImpl.setToBeRendered(PartImpl.java:508)
	at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.hidePart(PartServiceImpl.java:516)
	at org.eclipse.e4.workbench.ui.renderers.swt.StackRenderer$6.close(StackRenderer.java:448)
	at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1578)
	at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:261)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1050)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4039)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3630)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine$5.run(PartRenderingEngine.java:568)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.run(PartRenderingEngine.java:492)
	at org.eclipse.e4.workbench.ui.internal.E4Workbench.createAndRunUI(E4Workbench.java:101)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:526)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:512)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	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:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
	at java.lang.reflect.Method.invoke(Method.java:600)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)
Caused by: java.lang.NullPointerException
	at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.deactivateHandler(HandlerServiceImpl.java:104)
	at org.eclipse.ui.internal.handlers.LegacyHandlerService.deactivateHandler(LegacyHandlerService.java:229)
	at org.eclipse.ui.SubActionBars.clearGlobalActionHandlers(SubActionBars.java:198)
	at org.eclipse.ui.SubActionBars.dispose(SubActionBars.java:253)
	at org.eclipse.ui.SubActionBars2.dispose(SubActionBars2.java:106)
	at org.eclipse.ui.internal.EditorActionBars.dispose(EditorActionBars.java:160)
	at org.eclipse.ui.internal.EditorReference.disposeEditorActionBars(EditorReference.java:282)
	at org.eclipse.ui.internal.e4.compatibility.CompatibilityEditor.preDestroy(CompatibilityEditor.java:106)
	... 57 more
Comment 1 Oleg Besedin CLA 2010-04-06 10:25:38 EDT
Created attachment 163896 [details]
Patch

The problem manifests when one of the injected methods uses "outside" context values (such as a final IEclipseContext field from an outer class).

Patch applied to CVS Head.
Comment 2 Oleg Besedin CLA 2010-04-06 10:28:37 EDT
It should be fixed now; let me know if there is still a problem.
Comment 3 Remy Suen CLA 2010-04-07 08:44:16 EDT
Rolling back the fix for bug 308220 didn't help.

Rolling back the fix for bug 308194...is unknown, since the compatibility layer becomes unusable. :P
Comment 4 Remy Suen CLA 2010-04-07 08:47:10 EDT
(In reply to comment #3)
> Rolling back the fix for bug 308220 didn't help.
> 
> Rolling back the fix for bug 308194...is unknown, since the compatibility layer
> becomes unusable. :P

This comment was intended for bug 308317.