Community
Participate
Working Groups
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(); }
Note that ImageDataImageDescriptor's use of identity hash and ==, rather than Image.hashCode() and Image.equals(), is deliberate. We might want to mention this in the code. The reason for using these is that Image.hashCode() changes when the image is disposed, which also causes leaks when using resource managers.
Back link to our bug db: #32291.
This would be a good candidate for 3.3.2.
On a related note, earlier in 3.4, I did modify DecorationOverlayIcon to use the identity hashcode for the base image for the same reason (see bug 175526). It may be worthwhile considering backporting that change as well.
This is certainly a good candidate. McQ?
I have released this patch to the 3.4 stream for build >20071026. McQ I think this should go into 3.3.2
Patch released for 3.3.2 build >20071019
This change is causing the ResourceManagerTest suite to fail.
Checking the code for the test it turns out that the test was treating some entries as different that were in fact dups. Stefan and Nick if you could check ResourceManagerTest for me to make sure I am reading it right but I think the number of duplicates is 11 not 7 as the result for Bug 207075 indicates.
Please attach a patch to the bug.
Created attachment 80973 [details] Patch
+1 for adding this to 3.3.2.
Verified in 3.4 M3 by the results of the I builds.
This test has been in the 3.3.2 builds since November 28, 2007 so it is verified in 3.3.2