Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » NPE when using Dynamic Menu Contribution
NPE when using Dynamic Menu Contribution [message #1779180] Wed, 03 January 2018 16:16 Go to next message
Marcus Tangermann is currently offline Marcus TangermannFriend
Messages: 4
Registered: June 2017
Junior Member

I've implemented a dynamic menu contribution for a tree table according to using the Oxygen.2 release (4.7.2).
Everything works well until the application is closed. During closing, NPEs occure:

	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerHideProcessor.lambda$0(
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(
	at org.eclipse.swt.widgets.Display.runAsyncMessages(
	at org.eclipse.swt.widgets.Display.readAndDispatch(
	at org.eclipse.swt.widgets.Display.release(
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
	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(
	at org.eclipse.equinox.launcher.Main.basicRun(
	at org.eclipse.equinox.launcher.Main.main(

It seems that for every time the dynamic menu is shown, one NPE occurs. So for example, showing the menu 4 times lead to 4 NPEs when the application is closed.

The NPE is caused in the processDynamicElements function where it tries to retrieve the object of the dynamic menu contribution. This object is null which leads to my assumption that it was already disposed. This null object is then forwarded to the invoke function where it causes the NPE.

Any idea what could cause this situation ?
Re: NPE when using Dynamic Menu Contribution [message #1779220 is a reply to message #1779180] Thu, 04 January 2018 07:47 Go to previous message
Marcus Tangermann is currently offline Marcus TangermannFriend
Messages: 4
Registered: June 2017
Junior Member

for now I've temporarly solved the problem by implementing an own MenuManagerHidedProcessor as described in
Nevertheless, I'm not sure what the root cause of the problem is and whether it is a bug in Eclipse or my fault.
Previous Topic:Event Broker vs Context Variables
Next Topic:Part's persisted state is lost even with apply="notexists"
Goto Forum:

Current Time: Tue Mar 20 16:07:34 GMT 2018

Powered by FUDForum. Page generated in 0.02111 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software