Bug 284604 [Compatibility] Working the e4 SDK gets slower and slower
Over time as we open and close editors, we "leak" runAndTrack(*). We create a number of runAndTrack Runnables for various things, including one for each editor that iterates through the tab items. These runnables lifecycle are tied to the renderer, but the lifecycle of the IEclipseContext is tied to the model (which exists for as long as its MContributedPart). There are 2 parts to this in the short term: 1) If the runAndTrack is tied to SWT resources (like the CTabItem/ETabItem) it should go away when the part is disposed. 2) the model add that creates the context (currently org.eclipse.e4.workbench.ui.internal.Workbench.initializeContext(IEclipseContext, MPart<?>) ) should also makes sure it disposes the context on remove. PW
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/workbench/ui/renderers/swt/StackRenderer.java
import org.eclipse.e4.ui.widgets.ETabItem;
import org.eclipse.e4.workbench.ui.internal.IValueFunction;
import org.eclipse.e4.workbench.ui.renderers.AbstractPartRenderer;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.databinding.EMFObservables;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.databinding.swt.ISWTObservableValue;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.ImageData;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Widget;
public class StackRenderer extends LazyStackRenderer {