diff --git a/src/main/c/netty_jni_util.h b/src/main/c/netty_jni_util.h index a04e55d..cd29766 100644 --- a/src/main/c/netty_jni_util.h +++ b/src/main/c/netty_jni_util.h @@ -80,6 +80,14 @@ NETTY_JNI_UTIL_END_MACRO +#define NETTY_JNI_UTIL_NEW_LOCAL_FROM_WEAK(E, C, W, R) \ + NETTY_JNI_UTIL_BEGIN_MACRO \ + C = (*(E))->NewLocalRef((E), W); \ + if ((*(E))->IsSameObject((E), C, NULL) || C == NULL) { \ + goto R; \ + } \ + NETTY_JNI_UTIL_END_MACRO + #define NETTY_JNI_UTIL_GET_METHOD(E, C, M, N, S, R) \ NETTY_JNI_UTIL_BEGIN_MACRO \ M = (*(E))->GetMethodID((E), C, N, S); \