On Tue, 5 Aug 2025 12:00:47 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/prism/mtl/MTLTexture.java line 
>> 149:
>> 
>>> 147:                     for (int colIndex = 0; colIndex < rowStride; 
>>> colIndex += 3) {
>>> 148:                         index = rowIndex + colIndex;
>>> 149:                         arr32Bit[dstIndex++] = arr[index + 2];
>> 
>> `arr` might be `null` here if `buf.hasArray() == false`, resulting in an NPE.
>
> We use non-direct buffers, so it is very unlikely case. But adding a recovery 
> path seems right thing for now.
> Eventually we should evaluate if the buffer is always non-direct then 
> hasArray check can be removed from all pipelines. I shall file a followup bug 
> for this.

The buffer is sometimes direct, so the fallback case of creating a new byte 
array and copying it from the buffer should only be done where it is needed. 
See my inline comment.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1824#discussion_r2254782421

Reply via email to