RFR: 8319925: CSS.BackgroundImage incorrectly uses double-checked locking

Sergey Bylokhov serb at openjdk.org
Sat Dec 2 09:10:36 UTC 2023


On Fri, 1 Dec 2023 06:31:00 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

> 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.

That code does not look like double-checked lock, it is something different. It checks/init/sets one field and then returns another one. Even if both will be marked as volatile the method may return null, since the loadedImage is set to true before init of image.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/16917#issuecomment-1837095660


More information about the client-libs-dev mailing list