On Fri, 12 Jun 2020 12:37:01 GMT, Johan Vos <j...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/javafx/font/freetype/PangoGlyphLayout.java
>>  line 140:
>> 
>>> 139:             runUtf8.put(run, str);
>>> 140:             if (check(str, "Failed allocating UTF-8 buffer.", context, 
>>> desc, attrList)) {
>>> 141:                 return;
>> 
>> Did you really mean to store the run in the map before checking if str is 
>> null ?
>
> I'm not sure what should happen if str is null. Do we want to be able to 
> retry later? In that case, we shouldn't store
> it in the map. But if it is fatal, and seems to indicate a problem with rtext 
> (e.g. too big?), so in that case it might
> not be worth retrying.

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.

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

PR: https://git.openjdk.java.net/jfx/pull/249

Reply via email to