Bug 62097 [Perspectives] Toolbar MenuDetect listeners leaking
When I reset perspective we are leaking ToolBarContributionItem MenuDetect Listeners. STEPS 1) Look at workbench with Optimize It 2) Reset perspective 3) 10 menu detect listeners on items will be left around. Toolbars are not being leaked and we create this listener in ToolBarContributionItem fill(Coolbar,int) using an inner class that we have no reference too. The reference graphs indicates that the Display still has the listener in the event table
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarContributionItem.java
import java.util.Iterator;
import org.eclipse.jface.util.Assert;
import org.eclipse.jface.util.Policy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.CoolBar;
import org.eclipse.swt.widgets.CoolItem;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
/**
 * The <code>ToolBarContributionItem</code> class provides a wrapper for tool
 * bar managers when used in cool bar managers. It extends <code>ContributionItem</code>
 * but and provides some additional methods to customize the size of the cool
 * item and to retrieve the underlying tool bar manager.
 * <p>
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 * 
 * @since 3.0
 */
public class ToolBarContributionItem extends ContributionItem {