Community
Participate
Working Groups
When a popup menu is open and then gets dispose, clicking on one of its items produces the following NPE and application exits: > Exception in thread "main" java.lang.NullPointerException > at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:268) > at org.eclipse.swt.widgets.Display.runPopups(Display.java:4157) > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3699) under Linux, the poupmenu simply disappears (haven't tested it on Windows yet). I'll provide a gerrit with a test snippet and further information soon.
New Gerrit change created: https://git.eclipse.org/r/151317
Here is how the bug can be reproduced: 1) run snippet Bug_552223_NPE_Menu_setVisible under macos 2) right click in the window, a poup-menu appears 3) if you click the item everything is fine and the follwoing output is generated: > Item was clicked > The menu is now disposed 4) if you wait longer (e.g. 10 seconds) before you click (menu must be keept open) and the click the menuitem the application terminates with: > The menu is now disposed! > Exception in thread "main" java.lang.NullPointerException > at org.eclipse.swt.widgets.Menu._setVisible(Menu.java:268) > at org.eclipse.swt.widgets.Display.runPopups(Display.java:4157) > at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3699) > at Bug_552223_NPE_Menu_setVisible.main(PopupTest.java:71) Looking at the code, there seems to be special code to keep the window alive, but later on it seems that on dispose the display variable is cleared out, so the NPE occurs. As I don't have deeper knowledge about the cocoa part and not an cocoa development environment available I can't provide a patch but hope the provided information is enough for someone of the core team to reproduce and fix this, let me know if any further information is required.
(In reply to Christoph Laeubrich from comment #0) > haven't tested it on Windows Under Windows the behavior is: Menu stays open, menuitems can be clicked without a problem.
Gerrit change https://git.eclipse.org/r/151317 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=1048abd609e00d1a2c6fec6c200b81ce02c32076