RFR: 8352209: NPE com.sun.prism.d3d.D3DTextureData.getContext [v3]

Kevin Rushforth kcr at openjdk.org
Tue Nov 4 00:02:25 UTC 2025


On Mon, 3 Nov 2025 11:21:53 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/prism/d3d/D3DTextureResource.java line 41:
>> 
>>> 39:         if (resource != null) {
>>> 40:             resource.dispose();
>>> 41:             resource = null;
>> 
>> We do not set the resource to `null` for any classes like `D3DTextureResource`, `MTLTextureResource` or `ES2TextureResource`. But the actual reference to native resource is set to **0** in the `resource.dispose();` call ( i.e. in classes like, `D3DTextureData`, `MTLTextureData`, `ES2TextureData` ). So the actual dispose of resource is already guarded.
>> 
>> Setting null only for D3D may cause confusion, as to why is it not done for other pipelines.
>> So, I would recommend to remove, as current code is safe. Or
>> add the same for other pipelines as well.
>
> Might be worth adding a comment that the resource is freed natively so there's no need to dereference.

That might be a good idea (for all pipelines).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1951#discussion_r2488193229


More information about the openjfx-dev mailing list