Project: Eclipse_Platform_UI
Bug 369434 NPE on startup in PerspectiveStackRenderer when PS is hidden by Welcome view
Reported: 2012-01-23 13:55:05 | Status: verified fixed

I get an NPE on startup when the Welcome view was saved on-screen. The NPE occurs in PerspectiveStackRenderer#showTab(MUIElement) line 114: // relayout the perspective Composite psComp = ctrl.getParent(); StackLayout sl = (StackLayout) psComp.getLayout(); 114: sl.topControl = ctrl; psComp.layout(); It seems to work happily if I change the code to: // relayout the perspective Composite psComp = ctrl.getParent(); StackLayout sl = (StackLayout) psComp.getLayout(); if (sl != null) { sl.topControl = ctrl; psComp.layout(); } Steps to repeat: 1. Open to the Welcome / Intro (Help > Welcome) 2. Quit, and then restart. You should get the NPE below on startup. Daemon Thread [Thread-1] (Suspended (exception NullPointerException)) PerspectiveStackRenderer.showTab(MUIElement) line: 114 PerspectiveStackRenderer(LazyStackRenderer).postProcess(MUIElement) line: 97 PerspectiveStackRenderer.postProcess(MUIElement) line: 77 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 632 PartRenderingEngine.safeCreateGui(MUIElement) line: 718 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 689 PartRenderingEngine$7.run() line: 683 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 668 SashRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 59 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 628 PartRenderingEngine.safeCreateGui(MUIElement) line: 718 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 689 PartRenderingEngine$7.run() line: 683 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 668 WBWRenderer(SWTPartRenderer).processContents(MElementContainer<MUIElement>) line: 59 WBWRenderer.processContents(MElementContainer<MUIElement>) line: 584 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 628 PartRenderingEngine.safeCreateGui(MUIElement) line: 718 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 689 PartRenderingEngine$7.run() line: 683 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 668 PartRenderingEngine$9.run() line: 938 Realm.runWithDefault(Realm, Runnable) line: 332 PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 893 E4Workbench.createAndRunUI(MApplicationElement) line: 85 Workbench$4.run() line: 577 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 532 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149 IDEApplication.start(IApplicationContext) line: 124 EclipseAppHandle.run(Object) line: 196 EclipseAppLauncher.runApplication(Object) line: 110 EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object) line: 352 EclipseStarter.run(String[], Runnable) line: 179 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object...) line: 597 Main.invokeFramework(String[], URL[]) line: 624 Main.basicRun(String[]) line: 579 Main.run(String[]) line: 1433 Main.main(String[]) line: 1409

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/PerspectiveStackRenderer.java tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java