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

Lukasz Kostyra lkostyra at openjdk.org
Tue Nov 4 07:33:25 UTC 2025


On Mon, 3 Nov 2025 23:57:50 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:

>> 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).

~~It does make more sense, I noticed that we also often check `resource.isValid()` but we don't precede it with `resource == null` which would cause another potential NPE.~~

I'll revert this and add a comment in all backend-specific `*TextureResource` classes

**EDIT:** I got the `resource` instances mixed up - the checks I was thinking of would be for an instance of `D3D/ES2/MTLTextureResource`, not its underlying `D3D/ES2/MTLTextureData` instance that is also referred to as `resource` variable.

Still, the `ManagedResource` class that we extend in the backends will handle the `resource = null` set, so this addition is redundant.

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

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


More information about the openjfx-dev mailing list