Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 338022 - NPE in org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.showStack
Summary: NPE in org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.showStack
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.8   Edit
Hardware: PC Windows 7
: P3 major with 1 vote (vote)
Target Milestone: 4.8 M7   Edit
Assignee: Hilger Steenblock CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-23 16:07 EST by Olivier Thomann CLA
Modified: 2018-04-09 04:03 EDT (History)
5 users (show)

See Also:


Attachments
How to reproduce the error (49.74 KB, image/png)
2018-04-06 07:14 EDT, Hilger Steenblock CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2011-02-23 16:07:29 EST
Using !SESSION 2011-02-22 14:46:08.405 -----------------------------------------------
eclipse.buildId=I20110210-2002
java.version=1.6.0_24
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=fr_CA
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -console

I got a NPE in the method org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.showStack(..). This caused the UI to be unusable. I had to restart the workspace.

I don't have steps to reproduce so far. I was playing with the JUnit view making it a "fast" view using the minimize button.

org.eclipse.swt.SWTException: Failed to execute runnable (org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException)
	at org.eclipse.swt.SWT.error(SWT.java:4210)
	at org.eclipse.swt.SWT.error(SWT.java:4125)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:137)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4101)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3718)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$7.run(PartRenderingEngine.java:842)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:758)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:87)
	at org.eclipse.ui.internal.Workbench$3.run(Workbench.java:540)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:522)
	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:344)
	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:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Caused by: org.eclipse.e4.core.di.InjectionException: java.lang.NullPointerException
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:59)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:226)
	at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:196)
	at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:86)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:251)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.showElementInWindow(ModelServiceImpl.java:284)
	at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.bringToTop(ModelServiceImpl.java:237)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:504)
	at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.activate(PartServiceImpl.java:479)
	at org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer.activate(AbstractPartRenderer.java:105)
	at org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer$ActivationJob.run(StackRenderer.java:109)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:134)
	... 24 more
Caused by: java.lang.NullPointerException
	at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.showStack(TrimStack.java:413)
	at sun.reflect.GeneratedMethodAccessor29.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52)
	... 36 more
Comment 1 Eric Moffatt CLA 2011-02-24 15:27:10 EST
Olivier, is this something that works 'most of the time' but failed in this case? I'm just trying to get a handle on how hard this would be to repro...
Comment 2 Eric Moffatt CLA 2011-02-24 15:39:48 EST
Making major since it hoses the workbench...
Comment 3 Grant Gayed CLA 2011-03-04 10:49:53 EST
I've just seen this NPE on XP.  I don't have a reproducible set of steps either, but my immediate action that repeatedly caused the exception was File > Close All.  There were three java editors open at the time, and I had just launched e4, so the editors were open as a consequence of having been left open in the previous session.
Comment 4 Grant Gayed CLA 2011-03-04 10:52:00 EST
To clarify, I saw the same NPE, not the SWTException, so the context was
probably different from Olivier's.  I'm using e4 M5.
Comment 5 Hilger Steenblock CLA 2018-04-06 07:13:52 EDT
I got a NPE in TrimStack at line 1120 (and I'm not sure if I had to file a new entry or add it here).

How to reproduce:
1. Starting point is the E4 application com.example.e4.rcp.todo from Lars Vogels e4 training course.
2. Minimize a part like the Details part.
3. Open the Details part in the "overlay mode" (don't know how to call it, please see the attached screenshot for details).
4. Close the application.
5. -> NPE

java.lang.NullPointerException
    at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack.showStack(TrimStack.java:1120)
    at org.eclipse.e4.ui.workbench.addons.minmax.TrimStack$10.widgetDisposed(TrimStack.java:618)
    at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:124)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:86)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4428)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1079)

I propose to add a null check in line 916
public void showStack(boolean show) {
  Control ctrl = (Control) minimizedElement.getWidget();
  if (ctrl==null){
    return;
  }
Comment 6 Hilger Steenblock CLA 2018-04-06 07:14:43 EDT
Created attachment 273475 [details]
How to reproduce the error
Comment 7 Eclipse Genie CLA 2018-04-06 08:02:29 EDT
New Gerrit change created: https://git.eclipse.org/r/120848
Comment 9 Lars Vogel CLA 2018-04-09 04:03:28 EDT
Thanks, Hilger for the contribution and Mickael for the review.