Project: Eclipse_Platform_UI
Bug 205070 [JFace] ImageDataImageDescriptor's hashCode doesn't correspond to its equals method
Reported: 2007-10-01 11:26:35 | Status: verified fixed

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(); }

Files changed in fix:
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDataImageDescriptor.java