On Fri, 20 Dec 2019 13:36:16 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:

>> Could you please be more specific on why you suggest the check be expended 
>> with  `|| err != kCGLNoError`?
>> I see no harm in adding it but it feels like an unnecessary condition to me; 
>> my understanding of the current 
>> [documentation](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_pixelformats/opengl_pixelformats.html)
>>  (though the use of the API itself is deprecated by Apple) has me understand 
>> than `pix == NULL` is both a necessary and sufficient test.
> 
> From the documentation, the check `pix == NULL` seems sufficient, but the 
> `err != kCGLNoError` was used before, so I just want to keep it safe. If the 
> issue occurs without error getting printed it will be difficult to trace. As 
> you observed the OpenGL is deprecated, so suspecting documentation may not be 
> up to date. Also this 
> [doc](https://developer.apple.com/library/mac/documentation/GraphicsImaging/Reference/CGL_OpenGL/#//apple_ref/c/func/CGLChoosePixelFormat)
>  was referred for fixing  
> [JDK-8154148](https://bugs.openjdk.java.net/browse/JDK-8154148), and is no 
> longer available.
> However I can't find any documentation to support this `err != kCGLNoError` 
> check.

Actually, the existing check uses `err == kCGLNoError` which seems backwards 
(and likely is a big part of why this bug is happening). My recommendation is 
to not add in the check for `err != kCGLNoError`, and just use `if (pix == 
NULL)`.

The suggestion to add the print statement is a good one.

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

PR: https://git.openjdk.java.net/jfx/pull/65

Reply via email to