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

Nir Lisker nlisker at openjdk.org
Mon Nov 3 11:24:30 UTC 2025


On Mon, 3 Nov 2025 11:19:03 GMT, Ambarish Rapte <arapte at openjdk.org> wrote:

>> Lukasz Kostyra has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   BaseContext: Add maskTex checks to flushMask()
>
> 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.

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

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


More information about the openjfx-dev mailing list