Bug 283790 [Compatibility][UI] Limbo shell does not work properly for multiple workbench windows
1. Open the compatibility workbench, call this window A. 2. Open a file. 3. Window > New Window 4. Open the same file in window B. 5. Close the file in window B. 6. Close window B. 7. Close the file in window A. 8. It does not close, an exception is thrown. It seems the magic 'limbo' shell has been disposed. From my analysis, closing the file in window B caused the renderer to hide the child (although technically in this case it should've been outright disposed I suppose), instantiating the shell "under" window B's control. When window B was closed and disposed, its children was disposed likewise (i.e. the limbo shell). Now when we try to close the file in window A, the renderer tries to hide the child (incorrectly?) again, we check for null, it's non-null (albeit disposed) so we reuse it for setParent(Composite) and SWT blows up. java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:3865) at org.eclipse.swt.SWT.error(SWT.java:3799) at org.eclipse.swt.SWT.error(SWT.java:3770) at org.eclipse.swt.widgets.Control.setParent(Control.java:3892) at org.eclipse.e4.workbench.ui.renderers.swt.SWTPartRenderer.locallyHide(SWTPartRenderer.java:361) at org.eclipse.e4.workbench.ui.renderers.swt.SWTPartRenderer.childRemoved(SWTPartRenderer.java:303) at org.eclipse.e4.workbench.ui.renderers.swt.StackRenderer.childRemoved(StackRenderer.java:310) at org.eclipse.e4.workbench.ui.renderers.PartRenderingEngine.removeGui(PartRenderingEngine.java:179) at org.eclipse.e4.workbench.ui.renderers.PartRenderingEngine$1.notifyChanged(PartRenderingEngine.java:59) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) at org.eclipse.e4.ui.model.internal.application.MPartImpl.setVisible(MPartImpl.java:457) at org.eclipse.ui.internal.WorkbenchPage.disposePart(WorkbenchPage.java:770) at org.eclipse.ui.internal.WorkbenchPage.partRemoved(WorkbenchPage.java:761) at org.eclipse.ui.internal.WorkbenchPage.closeEditors(WorkbenchPage.java:560) at org.eclipse.ui.internal.WorkbenchPage.closeEditor(WorkbenchPage.java:584) at org.eclipse.ui.internal.WorkbenchPage$6.getValue(WorkbenchPage.java:1797) at org.eclipse.e4.workbench.ui.renderers.swt.StackRenderer$5.close(StackRenderer.java:364) at org.eclipse.e4.ui.widgets.CTabFolder.onMouse(CTabFolder.java:2189) at org.eclipse.e4.ui.widgets.CTabFolder$1.handleEvent(CTabFolder.java:317) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/workbench/ui/renderers/swt/SWTPartRenderer.java
if (!(widgetObject instanceof Composite)) {
			return null;
		}
		composite = (Composite) widgetObject;
		if (composite.getLayout() instanceof RowLayout) {
			RowLayout rl = (RowLayout) composite.getLayout();
			orientation = rl.type;
		}
		ToolBarManager manager = new ToolBarManager(SWT.FLAT | orientation);
		ToolBar swtToolBar = manager.createControl(composite);
		swtToolBar.setData(AbstractPartRenderer.OWNING_ME, toolbar);
		EList<MToolBarItem> items = toolbar.getItems();
		if (items != null && items.size() > 0) {
			for (MToolBarItem toolBarItem : toolbar.getItems()) {
				createToolBarItem(part, manager, toolBarItem);
			}
		}
		manager.update(true);
		return swtToolBar;
	}
	private void createToolBarItem(MPart<?> part, ToolBarManager manager,
			final MToolBarItem toolBarItem) {
		manager.add(new HandledContributionItem(toolBarItem, context));
	}
	private void createMenuItem(MPart<?> part, final MenuManager manager,
			final MHandledItem handledItem) {
		if (handledItem instanceof MMenuItemRenderer) {
			final IContributionItem renderer = (IContributionItem) ((MMenuItemRenderer) handledItem)
					.getRenderer();
			manager.add(renderer);