On Fri, 12 Jun 2020 14:16:06 GMT, Johan Vos <j...@openjdk.org> wrote:
>> If `str` is null, you would end up retrying it anyway, since `Map::get` will >> return `null` the next time (if there is a >> next time). Also, I think the dispose method might then crash trying to free >> a null pointer. So I think Phil is right >> and that you should not add the `str` to the `Map` if it is null. > > I don't think it will be `null` but it will be `0` in which case it is stored > in the `Map` > The only reason the str == null is then that we never tried to convert the > Java chars to utf8, unless I'm missing a > case? Oh, right. It will be a Long 0, not null. If you store it you will still have the problem I mentioned with dispose unless you add back in the `str != 0` check. And you would need a check for `str != 0` in the layout method so that the second time it doesn't treat it as a valid pointer. It might be safer to not store it if 0, which matches the current behavior? ------------- PR: https://git.openjdk.java.net/jfx/pull/249