Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369434

Summary: NPE on startup in PerspectiveStackRenderer when PS is hidden by Welcome view
Product: [Eclipse Project] Platform Reporter: Brian de Alwis <bsd>
Component: UIAssignee: Brian de Alwis <bsd>
Status: VERIFIED FIXED QA Contact: Eric Moffatt <emoffatt>
Severity: normal    
Priority: P3 CC: remy.suen
Version: 4.2   
Target Milestone: 4.2 M5   
Hardware: All   
OS: All   
Whiteboard:

Description Brian de Alwis CLA 2012-01-23 13:55:05 EST
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
Comment 1 Brian de Alwis CLA 2012-01-23 14:09:08 EST
Fix committed in 8b99abaf1a07cdb5500359715554408643c9c3a0
Comment 2 Brian de Alwis CLA 2012-01-24 13:50:48 EST
Verified in I20120123-2200.