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

Prasanta Sadhukhan psadhukhan at openjdk.org
Wed Dec 6 11:47:06 UTC 2023


On Tue, 5 Dec 2023 07:59:19 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.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Use image field for DCL

> > But it can be a bug in the code that it never gave a chance second time..I think it should get a chance to reload the URL again in case it is invalid the 1st time so I guess the change should be the one where if url is invalid, `loadedImage ` should not be set and it will need a relook at the url (to be set by user)
> 
> My point is it must re-load the image **whenever base is changed**, as @mrserb pointed out.
> 
> If you want to implement this feature, submit a new bug — it is out of scope for this issue. Better yet, just submit the new bug to document the discovered problem.
> 
> Re-loading the image if and only if the `url` is `null` is inconsistent. I strongly believe the image is to be re-loaded either _always_ or _never_ at all rather than sometimes.
> 
> Currently, it's in _never_ mode. I am for preserving the current behaviour rather than adding a half-baked solution.

OK. I have had my doubts but I agree to keep it as similar to code we have it now..Modified the PR..

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

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


More information about the client-libs-dev mailing list