RFR: JDK-8269921 TextFlow: listeners on bounds can throw NPE while computing text bounds [v5]

Florian Kirmaier fkirmaier at openjdk.org
Mon Oct 30 15:03:08 UTC 2023


On Wed, 25 Oct 2023 22:18:11 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/javafx/scene/text/Text.java line 359:
>> 
>>> 357:         if (spanBoundsInvalid) {
>>> 358:             GlyphList[] runs = getRuns();
>>> 359:             if (runs != null && runs.length != 0) {
>> 
>> on a surface, this check looks ok.
>> 
>> however, in getRuns(), Text:388 we have
>> 
>>             /* List of run is initialized when the TextFlow layout the children */
>>             getParent().layout();
>> 
>> meaning that `textRuns` did not initialize even though the `getParent().layout();`  was invoked - why?
>
> I mean, are we missing another step?

Yes, we are definitely missing something.
I looked at it for quite some time, without a better solution as this check.
If you'd like to investigate further - I would recommend you look into the stack trace of the ticket.
It's related to updating the bounds of the Node.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/564#discussion_r1376371128


More information about the openjfx-dev mailing list