-
Type:
Bug
-
Resolution: Fixed
-
Priority:
P4
-
Affects Version/s: 7, 8, 11, 17, 21
-
Component/s: client-libs
-
b27
CSS.BackgroundImage.getImage uses double-checked locking but the loadedImage field isn't declared as volatile. Without the volatile modifier, double-checked locking implementation is broken.
https://github.com/openjdk/jdk/blob/c9657cad124d2be10b8d6006d0ca9a038b1c5945/src/java.desktop/share/classes/javax/swing/text/html/CSS.java#L2950-L2955
https://shipilev.net/blog/2014/safe-public-construction/#_safe_publication
https://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Java
https://www.oracle.com/technical-resources/articles/javase/bloch-effective-08-qa.html // Search for "double-check idiom", the article has no anchors.
https://github.com/openjdk/jdk/blob/c9657cad124d2be10b8d6006d0ca9a038b1c5945/src/java.desktop/share/classes/javax/swing/text/html/CSS.java#L2950-L2955
https://shipilev.net/blog/2014/safe-public-construction/#_safe_publication
https://en.wikipedia.org/wiki/Double-checked_locking#Usage_in_Java
https://www.oracle.com/technical-resources/articles/javase/bloch-effective-08-qa.html // Search for "double-check idiom", the article has no anchors.