Skip to main content


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
Hello,

I've implemented a dynamic menu contribution for a tree table according to http://blog.vogella.com/2013/03/21/dynamic-menu-contributions-in-eclipse-e4/ using the Oxygen.2 release (4.7.2).
Everything works well until the application is closed. During closing, NPEs occure:

java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:239)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:132)
	at org.eclipse.e4.ui.workbench.renderers.swt.MenuManagerHideProcessor.lambda$0(MenuManagerHideProcessor.java:102)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:37)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:182)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4213)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3820)
	at org.eclipse.swt.widgets.Display.release(Display.java:3874)
	at org.eclipse.swt.graphics.Device.dispose(Device.java:298)
	at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:174)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	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:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)


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 messageGo to next message
Marcus Tangermann is currently offline Marcus TangermannFriend
Messages: 4
Registered: June 2017
Junior Member
Hi,

for now I've temporarly solved the problem by implementing an own MenuManagerHidedProcessor as described in https://www.eclipse.org/forums/index.php/t/1068074/
Nevertheless, I'm not sure what the root cause of the problem is and whether it is a bug in Eclipse or my fault.
Re: NPE when using Dynamic Menu Contribution [message #1784942 is a reply to message #1779180] Fri, 06 April 2018 07:59 Go to previous messageGo to next message
Jürgen Weinberger is currently offline Jürgen WeinbergerFriend
Messages: 42
Registered: August 2012
Member
Hi!
I have the same issue here. The same NPE as above appears, when i close my rcp application while a contextmenu with a dynamic Menu Contribution inside was shown. Even if the @AboutToShow is an empty method.
We are using eclipse 4.7.2 R2 as our targetplatform and the application runs in the compatibility mode.

If i remove the dynamic contribution from the fragment or close the application without having this contextmenu open, everything is fine.

I think this is a bug but i am not sure.
Best regards
Re: NPE when using Dynamic Menu Contribution [message #1784949 is a reply to message #1784942] Fri, 06 April 2018 09:01 Go to previous message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2902
Registered: July 2012
Senior Member
I'm using Photon and can not reproduce this issue. Could you post how your dynamic menu class looks like?
Previous Topic:editorActions and popupMenus replacement
Next Topic:intro page not displaying in e4 application
Goto Forum:
  


Current Time: Wed Apr 24 16:42:22 GMT 2024

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

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

Back to the top