| Summary: | ConsoleDropDownAction and OpenConsoleAction disposed on perspective reset | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Jonathan Williams <jonwilliams> |
| Component: | Debug | Assignee: | Andrey Loskutov <loskutov> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | loskutov, sarika.sinha |
| Version: | 4.5.2 | ||
| Target Milestone: | 4.8 M6 | ||
| Hardware: | PC | ||
| OS: | All | ||
| See Also: |
https://git.eclipse.org/r/117600 https://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=d1f97f64e7962451e851095d52726adbbc861cf4 |
||
| Whiteboard: | |||
|
Description
Jonathan Williams
I am able to cause a similar behavior to occur with the Open Console drop down menu as well. !ENTRY org.eclipse.ui 4 0 2018-02-15 18:39:22.554 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NullPointerException at org.eclipse.ui.internal.console.OpenConsoleAction.getMenu(OpenConsoleAction.java:84) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:513) at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:5268) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1348) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4522) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4107) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1150) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1039) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153) at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:680) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148) at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151) 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(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) 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) Workaround: You can access the dropdown menus again from a new Console View. Interesting, probably there since 3.x or at least since very beginning of 4.x. The *right* steps to reproduce: 1) Start with fresh SDK workspace (usually Java perspective without Console is shown) 2) Open Debug perspective (Console view is opened) 3) Open new Java Console and new OSGI Console (so that "Display selected console is enabled") 4) Click on "Display Selected" drop-down to see two consoles in the menu 5) Switch to Java perspective, open Console view 6) Reset Java perspective (Console view is closed) 7) Switch to Debug perspective and try to use both drop-down buttons => kaboom. The problem is that ConsoleDropDownAction and OpenConsoleAction created for both drop-down menus are disposed during Java perspective reset so that they will fail later to create menus if asked in Debug perspective. The reason is the code in org.eclipse.jface.action.ActionContributionItem.handleWidgetDispose(Event). It tries to dispose menus from drop-down contributions (that is probably OK) BUT also it tries to dispose the creators of those menus too. In our case this results in the disposing of the ConsoleDropDownAction and OpenConsoleAction still referenced in the Console view shown in another perspective :-( See the two stacks below. java.lang.NullPointerException at org.eclipse.ui.internal.console.OpenConsoleAction.getMenu(OpenConsoleAction.java:98) at org.eclipse.ui.internal.console.OpenConsoleAction.runWithEvent(OpenConsoleAction.java:81) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:565) at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86) java.lang.NullPointerException at org.eclipse.ui.internal.console.ConsoleDropDownAction.getMenu(ConsoleDropDownAction.java:80) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:513) at org.eclipse.jface.action.ActionContributionItem.lambda$5(ActionContributionItem.java:436) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86) New Gerrit change created: https://git.eclipse.org/r/117600 I have a patch, but it need to be tested for possible menu contributions leakage / other unexpected side effects. Gerrit change https://git.eclipse.org/r/117600 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.debug.git/commit/?id=d1f97f64e7962451e851095d52726adbbc861cf4 3.8 doesn't have the problem, but 4.5.2 has (I have no older 4.x instances right now to test). Just for the record, there were 203 reporters in Aeri for that: https://dev.eclipse.org/recommenders/committers/aeri/v2/#!/problems/5522d3e4e4b026254ee016f3 Eclipse SDK Version: Photon (4.8) Build id: I20180306-2000 |