RFR: 8352209: NPE com.sun.prism.d3d.D3DTextureData.getContext [v2]
Kevin Rushforth
kcr at openjdk.org
Thu Oct 30 12:08:05 UTC 2025
On Wed, 29 Oct 2025 11:06:15 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:
>> modules/javafx.graphics/src/main/java/com/sun/prism/d3d/D3DTexture.java line 91:
>>
>>> 89: public void update(MediaFrame frame, boolean skipFlush)
>>> 90: {
>>> 91: if (!resource.isValid()) {
>>
>> related - D3DTextureResource line 40 is
>>
>>
>> public void free() {
>> if (resource != null) {
>> resource.dispose();
>> }
>> }
>>
>>
>> should there be `resource = null;` after `resource.dispose()` ?
>
> It could add another layer of safety and make any potential future NPEs more easy to track - I'll add this.
In looking more closely at the code, it looks like adding `resource = null` in `free()` is redundant, since every caller of `free()` already does it right after calling it. It doesn't seem harmful, though.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1951#discussion_r2477855994
More information about the openjfx-dev
mailing list