On Tue, 6 May 2025 07:33:07 GMT, Michael Strauß <mstra...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/application/preferences/PreferenceProperties.java
>>  line 184:
>> 
>>> 182: 
>>> 183:             for (DeferredProperty<?> property : 
>>> deferredProperties.values()) {
>>> 184:                 property.fireValueChangedIfNecessary();
>> 
>> firing events from a synchronized method is a recipe for a lockup.
>> JavaFX is still a single threaded toolkit (if we ignore the creation of 
>> certain objects aspect), why do we want to synchronize?
>
> I've moved the `fireValueChangedIfNecessary` out of the synchronized block. 
> We need the synchronized block as a memory barrier to see the latest value of 
> the `effectiveValue` field, as we need to be able to read it from any thread.

Maybe a `volatile` would be a better choice then?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1655#discussion_r2075657221

Reply via email to