Project: Eclipse_Platform_UI
Bug 377837 NPE on CTF tab switch
Reported: 2012-04-26 17:50:26 | Status: verified fixed

I seem occasional NPEs when switching tabs to an as-yet unopened part: if (item != null) { MUIElement ele = (MUIElement) item.getData(OWNING_ME); if (ele.getParent().getSelectedElement() == ele) { Control ctrl = (Control) ele.getWidget(); ctrl.setFocus(); } } Checking that ctrl != null avoids the issue. java.lang.NullPointerException: StackRenderer$8.mouseUp(MouseEvent) line: 878 TypedListener.handleEvent(Event) line: 220 EventTable.sendEvent(Event) line: 84 Display.sendEvent(EventTable, Event) line: 4130 CTabFolder(Widget).sendEvent(Event) line: 1457 CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1480 CTabFolder(Widget).sendEvent(int, Event) line: 1465 CTabFolder(Widget).notifyListeners(int, Event) line: 1270 Display.runDeferredEvents() line: 3976 Display.readAndDispatch() line: 3615 WorkbenchPage.firePartOpened(CompatibilityPart) line: 4365 CompatibilityPart$2.handleEvent(Event) line: 110 UIEventHandler$1.run() line: 41 UISynchronizer(Synchronizer).syncExec(Runnable) line: 180 UISynchronizer.syncExec(Runnable) line: 150 Display.syncExec(Runnable) line: 4597 E4Application$1.syncExec(Runnable) line: 185 UIEventHandler.handleEvent(Event) line: 38 EventHandlerWrapper.handleEvent(Event, Permission) line: 197 EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197 EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1 EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 230 ListenerQueue.dispatchEventSynchronous(int, Object) line: 148 EventAdminImpl.dispatchEvent(Event, boolean) line: 135 EventAdminImpl.sendEvent(Event) line: 78 EventComponent.sendEvent(Event) line: 39 EventBroker.send(String, Object) line: 81 UIEventPublisher.notifyChanged(Notification) line: 57 PartImpl(BasicNotifierImpl).eNotify(Notification) line: 374 PartImpl.setObject(Object) line: 378 ContributedPartRenderer.createWidget(MUIElement, Object) line: 143 PartRenderingEngine.createWidget(MUIElement, Object) line: 883 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 617 PartRenderingEngine$6.run() line: 506 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement, Object, IEclipseContext) line: 491 ElementReferenceRenderer.createWidget(MUIElement, Object) line: 74 PartRenderingEngine.createWidget(MUIElement, Object) line: 883 PartRenderingEngine.safeCreateGui(MUIElement, Object, IEclipseContext) line: 617 PartRenderingEngine.safeCreateGui(MUIElement) line: 719 PartRenderingEngine.access$2(PartRenderingEngine, MUIElement) line: 690 PartRenderingEngine$7.run() line: 684 SafeRunner.run(ISafeRunnable) line: 42 PartRenderingEngine.createGui(MUIElement) line: 669 PartServiceImpl$1.handleEvent(Event) line: 95 UIEventHandler$1.run() line: 41 UISynchronizer(Synchronizer).syncExec(Runnable) line: 180 UISynchronizer.syncExec(Runnable) line: 150 Display.syncExec(Runnable) line: 4597 E4Application$1.syncExec(Runnable) line: 185 UIEventHandler.handleEvent(Event) line: 38 EventHandlerWrapper.handleEvent(Event, Permission) line: 197 EventHandlerTracker.dispatchEvent(EventHandlerWrapper, Permission, int, Event) line: 197 EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 1 EventManager.dispatchEvent(Set, EventDispatcher, int, Object) line: 230 ListenerQueue.dispatchEventSynchronous(int, Object) line: 148 EventAdminImpl.dispatchEvent(Event, boolean) line: 135 EventAdminImpl.sendEvent(Event) line: 78 EventComponent.sendEvent(Event) line: 39 EventBroker.send(String, Object) line: 81 UIEventPublisher.notifyChanged(Notification) line: 57 PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 374 PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 171 StackRenderer$7.widgetSelected(SelectionEvent) line: 848 TypedListener.handleEvent(Event) line: 248 EventTable.sendEvent(Event) line: 84 Display.sendEvent(EventTable, Event) line: 4130 CTabFolder(Widget).sendEvent(Event) line: 1457 CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1480 CTabFolder(Widget).sendEvent(int, Event) line: 1465 CTabFolder(Widget).notifyListeners(int, Event) line: 1270 CTabFolder.setSelection(int, boolean) line: 3025 CTabFolder.onMouse(Event) line: 1731 CTabFolder$1.handleEvent(Event) line: 270 EventTable.sendEvent(Event) line: 84 Display.sendEvent(EventTable, Event) line: 4130 CTabFolder(Widget).sendEvent(Event) line: 1457 CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1480 CTabFolder(Widget).sendEvent(int, Event) line: 1465 CTabFolder(Widget).notifyListeners(int, Event) line: 1270 Display.runDeferredEvents() line: 3976 Display.readAndDispatch() line: 3615 PartRenderingEngine$9.run() line: 1016 Realm.runWithDefault(Realm, Runnable) line: 332 PartRenderingEngine.run(MApplicationElement, IEclipseContext) line: 910 E4Workbench.createAndRunUI(MApplicationElement) line: 86 Workbench$4.run() line: 582 Realm.runWithDefault(Realm, Runnable) line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 537 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: 353 EclipseStarter.run(String[], Runnable) line: 180 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: 629 Main.basicRun(String[]) line: 584 Main.run(String[]) line: 1438 Main.main(String[]) line: 1414

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