On Fri, 20 Dec 2019 13:50:16 GMT, Kevin Rushforth <k...@openjdk.org> wrote:
>> 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. Actually, `err == kCGLNoError` was used before and not `err != kCGLNoError` (i.e. equals and not different) and that is in fact the reason for the bug (in conjunction with the AND). As you note, it's unfortunate that the link you mentioned is no longer valid as it would be very useful to understand the motivation behind the original fix in JDK-8154148, because it is indeed quite puzzling. Please note that in any case a check on `err != kCGLNoError` is done just before the function returns and the error is logged if true. ------------- PR: https://git.openjdk.java.net/jfx/pull/65