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

2023-12-07 Thread Alexey Ivanov
On Wed, 6 Dec 2023 11:47:03 GMT, Prasanta Sadhukhan 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

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

2023-12-06 Thread Prasanta Sadhukhan
On Tue, 5 Dec 2023 07:59:19 GMT, Prasanta Sadhukhan 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

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

2023-12-06 Thread Prasanta Sadhukhan
> 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

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

2023-12-05 Thread Alexey Ivanov
On Tue, 5 Dec 2023 14:24:09 GMT, Prasanta Sadhukhan wrote: > 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,

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

2023-12-05 Thread Prasanta Sadhukhan
On Tue, 5 Dec 2023 14:09:42 GMT, Alexey Ivanov wrote: > > > if the URL is invalid, the image isn't loaded > > > > > > As per your change, if URL is invalid ie url = null, image is not loaded > > but `loadedImage` is set to true so it will not give another chance to load > > the URL again via

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

2023-12-05 Thread Alexey Ivanov
On Tue, 5 Dec 2023 07:59:19 GMT, Prasanta Sadhukhan 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

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

2023-12-05 Thread Prasanta Sadhukhan
On Tue, 5 Dec 2023 13:02:36 GMT, Alexey Ivanov wrote: > if the URL is invalid, the image isn't loaded if (!loadedImage) { URL url = CSS.getURL(base, svalue); if (url != null) { image = new ImageIcon();

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

2023-12-05 Thread Alexey Ivanov
On Tue, 5 Dec 2023 07:55:22 GMT, Prasanta Sadhukhan wrote: > > > > It is probably easy just drop the usage of loadedImage and use the > > > > image instead? > > > > > > > > > Ideally. Yet there's a corner case: if `url` is null, there's nothing to > > > load; and it doesn't make sense to re-

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

2023-12-05 Thread Prasanta Sadhukhan
> 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

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

2023-12-05 Thread Prasanta Sadhukhan
On Mon, 4 Dec 2023 21:51:15 GMT, Sergey Bylokhov wrote: > > > It is probably easy just drop the usage of loadedImage and use the image > > > instead? > > > > > > Ideally. Yet there's a corner case: if `url` is null, there's nothing to > > load; and it doesn't make sense to re-try, the URL won

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

2023-12-04 Thread Sergey Bylokhov
On Mon, 4 Dec 2023 21:06:04 GMT, Alexey Ivanov wrote: > > It is probably easy just drop the usage of loadedImage and use the image > > instead? > > Ideally. Yet there's a corner case: if `url` is null, there's nothing to > load; and it doesn't make sense to re-try, the URL won't change. If it

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

2023-12-04 Thread Alexey Ivanov
On Mon, 4 Dec 2023 20:42:48 GMT, Sergey Bylokhov wrote: > It is probably easy just drop the usage of loadedImage and use the image > instead? Ideally. Yet there's a corner case: if `url` is null, there's nothing to load; and it doesn't make sense to re-try, the URL won't change. If it were not

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

2023-12-04 Thread Sergey Bylokhov
On Fri, 1 Dec 2023 06:31:00 GMT, Prasanta Sadhukhan 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. It is probably easy just drop the usa

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

2023-12-04 Thread Alexey Ivanov
On Mon, 4 Dec 2023 06:30:01 GMT, Prasanta Sadhukhan wrote: > > 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 > > loa

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

2023-12-04 Thread Alexey Ivanov
On Fri, 1 Dec 2023 06:31:00 GMT, Prasanta Sadhukhan 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. Based on my recent comment, the code

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

2023-12-03 Thread Prasanta Sadhukhan
On Sat, 2 Dec 2023 09:07:38 GMT, Sergey Bylokhov wrote: > 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 >

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

2023-12-02 Thread Sergey Bylokhov
On Fri, 1 Dec 2023 06:31:00 GMT, Prasanta Sadhukhan 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-c

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

2023-12-01 Thread Alexey Ivanov
On Fri, 1 Dec 2023 06:31:00 GMT, Prasanta Sadhukhan 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. Marked as reviewed by aivanov (Review

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

2023-11-30 Thread Prasanta Sadhukhan
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. - Commit messages: - 8319925: CSS.BackgroundImage incorrectly uses double-checked locking