Bug 205070 [JFace] ImageDataImageDescriptor's hashCode doesn't correspond to its equals method
3.3 ImageDataImageDescriptor.hashCode() and equals don't correspond when it's created from an original image. Note that a new ImageData object is created each time, so comparing hashCode/equals on the resulting ImageData does not allow supposedly-equivalent image descriptors to compare (or hash) properly. This can result in leaks when the image descriptor is used in a resource manager. Suggested change: public int hashCode() { if (originalImage != null) { return System.identityHashCode(originalImage); } return data.hashCode(); }
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDataImageDescriptor.java
/* (non-Javadoc)
     * @see org.eclipse.jface.resource.DeviceResourceDescriptor#create(org.eclipse.swt.graphics.Device)
     */
    public Object createResource(Device device) throws DeviceResourceException {
        
        
        if (originalImage != null) {
            
            if (originalImage.getDevice() == device) {
                return originalImage;
            }
        }
        
        return super.createResource(device);
    }
	
    /* (non-Javadoc)
     * @see org.eclipse.jface.resource.DeviceResourceDescriptor#destroy(java.lang.Object)
     */
    public void destroyResource(Object previouslyCreatedObject) {
        if (previouslyCreatedObject == originalImage) {
            return;
        }
        
        super.destroyResource(previouslyCreatedObject);
    }
    
    /* (non-Javadoc)
     * @see org.eclipse.jface.resource.ImageDescriptor#getImageData()