On Sat, 18 Nov 2023 13:59:34 GMT, Julian Waters <[email protected]> wrote:
>> src/java.desktop/windows/native/libawt/windows/awt_Canvas.cpp line 217: >> >>> 215: env->ExceptionClear(); >>> 216: JNU_ThrowNullPointerException(env, "peer"); >>> 217: env->DeleteGlobalRef(canvas); >> >> you didn't code this up the way I did in my comment, which I think you >> should have done, and here you are deleting a ref to NULL, and the string >> passed to throw doesn't mention the canvas, which it can do unlike the old >> code. > > Sorry, I was trying to keep as close to the original code as possible. Woah, > does that mean the original was bugged, since it was deleting a NULL canvas? > Anyway, should I change the string to canvas or just keep it as "peer" like > the original code does in that case? Not buggy per se, since NULL is allowed https://docs.oracle.com/en/java/javase/21/docs/specs/jni/functions.html#deleteglobalref But that doesn't make it good practice. Yes, change the name because then it is more precise. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15096#discussion_r1399691542
