RFR: 8341418: Prism/es2 DrawableInfo is never freed (leak) [v2]

Michael Strauß mstrauss at openjdk.org
Mon Oct 7 03:29:41 UTC 2024


On Sun, 6 Oct 2024 19:12:42 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/prism/es2/ES2SwapChain.java line 193:
>> 
>>> 191:     @Override
>>> 192:     public ES2Graphics createGraphics() {
>>> 193:         if (drawable == null || drawable.getNativeWindow() != pState.getNativeWindow()) {
>> 
>> The null check wasn't here before, and it doesn't seem necessary as `createGLDrawable()` does not return `null`.
>
> But drawable can now be disposed and set to null. If that happens and `createGraphics` is called again it will end in a NPE.

The NPE would be a good thing then, as no method should be called on a disposed object (except for `dispose`).

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1586#discussion_r1789427891


More information about the openjfx-dev mailing list