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

Florian Kirmaier fkirmaier at openjdk.org
Tue Oct 31 12:32:45 UTC 2023


On Mon, 30 Oct 2023 15:22:51 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> 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.
>
> I would suggest investigating this a bit further.
> 
> The semantics of this method is to return valid Bounds, and it looks like we do not honor this contract.  It is possible that we get the original exception because the listener is being called during layout (just guessing) - will this method be called again and return the valid value second time?  Or do we need to actually call the layout() to ensure that we do, in fact, have a valid layout every time this method is called?

generally speaking - the behavior relating to the bounds is broken.

Some components behave differently, after setting a listener to the bounds.
 1.) Groups tend to call layout in the children.
 2.) And Text seems to call layout on it's parent TextFlow
Both cases are serious problems in my opinion - and this should be designed somehow differently.

But for now, i would be happy if the affected applications don't crash by this bug here.

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

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


More information about the openjfx-dev mailing list