Bug 331685 Unset context from model if widget creation failed since the context is disposed
If the renderer fails to create a widget for a given element, it will dispose its created context (if any) prior to returning from the call. If we try to deconstruct the element later, it will fail with an NPE because the context has been disposed and getParent() will return null.
bundles/org.eclipse.e4.ui.workbench.swt/src/org/eclipse/e4/ui/internal/workbench/swt/PartRenderingEngine.java
public static final String engineURI = "platform:/plugin/org.eclipse.e4.ui.workbench.swt/"
			+ "org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine";
	private static final String defaultFactoryUrl = "platform:/plugin/org.eclipse.e4.ui.workbench.renderers.swt/"
			+ "org.eclipse.e4.ui.workbench.renderers.swt.WorkbenchRendererFactory";
	private String factoryUrl;
	IRendererFactory curFactory = null;
	org.eclipse.swt.widgets.Listener keyListener;
	
	private EventHandler toBeRenderedHandler = new EventHandler() {
		public void handleEvent(Event event) {
			MUIElement changedElement = (MUIElement) event
					.getProperty(UIEvents.EventTags.ELEMENT);
			MElementContainer<?> parent = changedElement.getParent();
			
			if (parent == null && changedElement instanceof MWindow) {
				parent = (MElementContainer<?>) ((EObjectImpl) changedElement)
						.eContainer();
			}
			boolean menuChild = parent instanceof MMenu;
			
			if (parent == null || parent.getWidget() == null || menuChild)
				return;
			if (changedElement.isToBeRendered()) {
				Activator.trace(Policy.DEBUG_RENDERER, "visible -> true", null); 
				
				Object w = createGui(changedElement);
				if (w instanceof Control && !(w instanceof Shell)) {
					fixZOrder(changedElement);
				}
			} else {