RFR: 8347392: Thread-unsafe implementation of c.s.j.scene.control.skin.Utils [v2]

Andy Goryachev angorya at openjdk.org
Fri Feb 7 17:58:16 UTC 2025


On Fri, 7 Feb 2025 16:33:27 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Thread-safe and re-entrant implementation of Utils.
>> 
>> The new code still uses the static instances of Text and TextLayout for performance reasons, but adds a thread-safe mechanism to keep track of whether any of the instances is in use and when that happens, supplies a new instance instead.  This solves both thread safety and re-entrancy.
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
> 
>   review comments

Hmmm, to further make a point: options 2 and 3 may not be re-entrant, so they probably won't work.

We haven't encounter this re-entrancy issue, but I suppose it might be possible to have a text component embedded in another text component (e.g. a TextArea embedded inside a RichTextArea for some reason).  Even if the access happens within the FX application thread, the inner layout might clobber the outer one.

Thank you for a good discussion though!

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

PR Comment: https://git.openjdk.org/jfx/pull/1691#issuecomment-2643614530


More information about the openjfx-dev mailing list