Bug 9826 [Contributions] ActionContributionItem caches Images forever
ActionContributionItem has an image cache that caches images forever, and won't release them until the Display goes down. If an Action updates its Image, such as a background color or foreground color action, It's ImageDescriptor is constantly changing. ActionContributionItem$ImageCache creates an SWT Image for each descriptor. I verified this by constantly (a.k.a. programmatically) changing an actions ImageDescriptor, using only ImageData to build the descriptor. I quickly got a "no more handles" crash.
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.Policy;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Item;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.swt.widgets.Widget;
/**
 * A contribution item which delegates to an action.
 * <p>
 * This class may be instantiated; it is not intended to be subclassed.
 * </p>
 */
public class ActionContributionItem extends ContributionItem {