On Thu, 19 Nov 2026 01:04:45 GMT, Kevin Rushforth <[email protected]> wrote:

>> Lukasz Kostyra has updated the pull request incrementally with one 
>> additional commit since the last revision:
>> 
>>   Review fixes from @kevinrushforth
>
> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeDevice.cpp 
> line 991:
> 
>> 989:     D3D12::Internal::JNIBuffer<jfloatArray> vertsArray(env, nullptr, 
>> vertices);
>> 990:     D3D12::Internal::JNIBuffer<jbyteArray> colorsArray(env, nullptr, 
>> colors);
>> 991:     if (!vertsArray || !colorsArray) return;
> 
> To avoid possible pending JNI exception:
> 
> Suggestion:
> 
>     D3D12::Internal::JNIBuffer<jfloatArray> vertsArray(env, nullptr, 
> vertices);
>     if (!vertsArray) return;
>     D3D12::Internal::JNIBuffer<jbyteArray> colorsArray(env, nullptr, colors);
>     if (!colorsArray) return;

Done

> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeMesh.cpp line 
> 122:
> 
>> 120:     D3D12::Internal::JNIBuffer<jfloatArray> vertsBuffer(env, nullptr, 
>> verts);
>> 121:     D3D12::Internal::JNIBuffer<jintArray> indicesBuffer(env, nullptr, 
>> indices);
>> 122:     if (!vertsBuffer || !indicesBuffer) return false;
> 
> Suggestion:
> 
>     D3D12::Internal::JNIBuffer<jfloatArray> vertsBuffer(env, nullptr, verts);
>     if (!vertsBuffer) return false;
>     D3D12::Internal::JNIBuffer<jintArray> indicesBuffer(env, nullptr, 
> indices);
>     if (!indicesBuffer) return false;

Done

> modules/javafx.graphics/src/main/native-prism-d3d12/D3D12NativeMesh.cpp line 
> 145:
> 
>> 143:     D3D12::Internal::JNIBuffer<jfloatArray> vertsBuffer(env, nullptr, 
>> verts);
>> 144:     D3D12::Internal::JNIBuffer<jshortArray> indicesBuffer(env, nullptr, 
>> indices);
>> 145:     if (!vertsBuffer || !indicesBuffer) return false;
> 
> Suggestion:
> 
>     D3D12::Internal::JNIBuffer<jfloatArray> vertsBuffer(env, nullptr, verts);
>     if (!vertsBuffer) return false;
>     D3D12::Internal::JNIBuffer<jshortArray> indicesBuffer(env, nullptr, 
> indices);
>     if (!indicesBuffer) return false;

Done

> modules/javafx.graphics/src/main/native-prism-d3d12/internal/D3D12Logger.cpp 
> line 124:
> 
>> 122:         if (Config::IsColorLogsEnabled())
>> 123:         {
>> 124:             GetConsoleScreenBufferInfo(stdOutHandle, &consoleInfo);
> 
> `GetConsoleScreenBufferInfo` doesn't guarantee to initialize `consoleInfo`. 
> If there is an error, it might be uninitialized in which case later on in 
> this function, it will read an uninitialized `consoleInfo.wAttributes`.

Done

> modules/javafx.graphics/src/main/native-prism-d3d12/internal/JNIBuffer.hpp 
> line 87:
> 
>> 85:         if (mData == nullptr) return;
>> 86: 
>> 87:         mElementCount = 
>> static_cast<size_t>(mJNIEnv->GetArrayLength(array));
> 
> Other JNI calls such as `GetArrayLength` should not be called inside a 
> critical region (that is, between `GetPrimitiveArrayCritical` and 
> `ReleasePrimitiveArrayCritical`). This might be tricky to solve if two such 
> buffers are created and used at the same time, since the second buffer will 
> query the length while the first is pinned.

I will have to take a longer look at this. For now I'll omit it from today's 
batch of fixes and see if I can solve this, but if it gets too complicated I 
might leave it as a follow-up.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4630518185
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4630520493
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4630522019
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4630546892
PR Review Comment: https://git.openjdk.org/jfx/pull/2346#discussion_r4630584997

Reply via email to