On Tue, 18 Apr 2023 02:08:03 GMT, Alexander Matveev <almat...@openjdk.org> 
wrote:

> - Added missing exception checks for JNI calls.
>  - Improved JNI error checking by checking for both exception and return 
> value.
>  - Minor code clean up.

modules/javafx.media/src/main/native/jfxmedia/jni/Logger.cpp line 130:

> 128:         // Get global reference
> 129:         m_cls = (jclass)pEnv->NewWeakGlobalRef(local_cls);
> 130:         pEnv->DeleteLocalRef(local_cls);

What is this code attempting to do? After `local_cls` is deleted, `m_cls` 
refers to a potentially freed object and is thus not safe to use. In order to 
do anything meaningful with `m_cls`, a strong reference needs to be acquired 
with `NewLocalRef(m_cls)`.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1094#discussion_r1174812607

Reply via email to