Bug 327807 CTabItem disposal causes change in an MPartStack's selectedElement
Thread [main] (Suspended) StackRenderer.showTab(MUIElement) line: 497 LazyStackRenderer$1.handleEvent(Event) line: 73 UIEventHandler.handleEvent(Event) line: 41 EventHandlerWrapper.handleEvent(Event, Permission) line: 188 EventHandlerTracker.dispatchEvent(Object, Object, int, Object) line: 198 EventManager.dispatchEvent(Set<Entry<K,V>>, EventDispatcher<K,V,E>, int, E) line: 230 ListenerQueue<K,V,E>.dispatchEventSynchronous(int, E) line: 148 EventAdminImpl.dispatchEvent(Event, boolean) line: 139 EventAdminImpl.sendEvent(Event) line: 78 EventComponent.sendEvent(Event) line: 39 EventBroker.send(String, Object) line: 73 UIEventPublisher.notifyChanged(Notification) line: 58 PartStackImpl(BasicNotifierImpl).eNotify(Notification) line: 380 PartStackImpl(ElementContainerImpl<T>).setSelectedElement(T) line: 159 StackRenderer$3.widgetSelected(SelectionEvent) line: 436 TypedListener.handleEvent(Event) line: 234 EventTable.sendEvent(Event) line: 84 CTabFolder(Widget).sendEvent(Event) line: 1053 CTabFolder(Widget).sendEvent(int, Event, boolean) line: 1077 CTabFolder(Widget).sendEvent(int, Event) line: 1062 CTabFolder(Widget).notifyListeners(int, Event) line: 774 CTabFolder.setSelection(int, boolean) line: 2830 CTabFolder.destroyItem(CTabItem) line: 519 CTabItem.dispose() line: 126 StackRenderer.hideChild(MElementContainer<MUIElement>, MUIElement) line: 395 PartRenderingEngine.removeGui(MUIElement) line: 573 PartRenderingEngine.removeGui(MUIElement) line: 584 PartRenderingEngine.removeGui(MUIElement) line: 584 PartRenderingEngine.removeGui(MUIElement) line: 584 PartRenderingEngine.removeGui(MUIElement) line: 584 PartRenderingEngine.removeGui(MUIElement) line: 584 WorkbenchWindow.hardClose(boolean) line: 1356 WorkbenchWindow.busyClose(boolean) line: 1058 WorkbenchWindow.access$9(WorkbenchWindow, boolean) line: 1037 WorkbenchWindow$6.run() line: 1084 BusyIndicator.showWhile(Display, Runnable) line: 70 WorkbenchWindow.close(boolean) line: 1082 Workbench$14.run() line: 1047 SafeRunner.run(ISafeRunnable) line: 42 Workbench.busyClose(boolean) line: 1041 Workbench.access$11(Workbench, boolean) line: 955 Workbench$15.run() line: 1121 BusyIndicator.showWhile(Display, Runnable) line: 70 Workbench.close(int, boolean) line: 1119 Workbench.close() line: 1092 WorkbenchWindow.busyClose(boolean) line: 1055 WorkbenchWindow.access$9(WorkbenchWindow, boolean) line: 1037 WorkbenchWindow$6.run() line: 1084 BusyIndicator.showWhile(Display, Runnable) line: 70 WorkbenchWindow.close(boolean) line: 1082 WorkbenchWindow.close() line: 1098 WorkbenchWindow$4.close(MWindow) line: 426 WBWRenderer$8.shellClosed(ShellEvent) line: 419
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/workbench/PartRenderingEngineTests.java
MApplication application = ApplicationFactoryImpl.eINSTANCE
				.createApplication();
		MWindow window = BasicFactoryImpl.eINSTANCE.createWindow();
		application.getChildren().add(window);
		application.setSelectedElement(window);
		MPartStack partStack = BasicFactoryImpl.eINSTANCE.createPartStack();
		window.getSharedElements().add(partStack);
		MPart part1 = BasicFactoryImpl.eINSTANCE.createPart();
		partStack.getChildren().add(part1);
		MPart part2 = BasicFactoryImpl.eINSTANCE.createPart();
		partStack.getChildren().add(part2);
		partStack.setSelectedElement(part2);
		MPerspectiveStack perspectiveStack = AdvancedFactoryImpl.eINSTANCE
				.createPerspectiveStack();
		window.getChildren().add(perspectiveStack);
		window.setSelectedElement(perspectiveStack);
		MPerspective perspectiveA = AdvancedFactoryImpl.eINSTANCE
				.createPerspective();
		perspectiveStack.getChildren().add(perspectiveA);
		perspectiveStack.setSelectedElement(perspectiveA);
		MPlaceholder placeholderA = AdvancedFactoryImpl.eINSTANCE
				.createPlaceholder();
		placeholderA.setRef(partStack);
		partStack.setCurSharedRef(placeholderA);
		perspectiveA.getChildren().add(placeholderA);
		perspectiveA.setSelectedElement(placeholderA);
		MPerspective perspectiveB = AdvancedFactoryImpl.eINSTANCE
				.createPerspective();
		perspectiveStack.getChildren().add(perspectiveB);
		MPlaceholder placeholderB = AdvancedFactoryImpl.eINSTANCE