Commit f9207135 authored by Thomas Guillem's avatar Thomas Guillem

android_utils: use ExceptionCheck

Convenience function to check for pending exceptions without creating a local
reference to the exception object (that was not released).
parent fbfc6cec
......@@ -121,7 +121,7 @@ NativeSurface_getHandle(JNIEnv *p_env, jobject jsurf)
intptr_t p_surface_handle = NULL;
clz = (*p_env)->GetObjectClass(p_env, jsurf);
if ((*p_env)->ExceptionOccurred(p_env))
if ((*p_env)->ExceptionCheck(p_env))
{
(*p_env)->ExceptionClear(p_env);
return NULL;
......@@ -129,23 +129,15 @@ NativeSurface_getHandle(JNIEnv *p_env, jobject jsurf)
fid = (*p_env)->GetFieldID(p_env, clz, "mSurface", "I");
if (fid == NULL)
{
jthrowable exp = (*p_env)->ExceptionOccurred(p_env);
if (exp)
{
(*p_env)->DeleteLocalRef(p_env, exp);
if ((*p_env)->ExceptionCheck(p_env))
(*p_env)->ExceptionClear(p_env);
}
fid = (*p_env)->GetFieldID(p_env, clz, "mNativeSurface", "I");
if (fid == NULL)
{
jthrowable exp = (*p_env)->ExceptionOccurred(p_env);
if (exp)
{
(*p_env)->DeleteLocalRef(p_env, exp);
if ((*p_env)->ExceptionCheck(p_env))
(*p_env)->ExceptionClear(p_env);
}
}
}
if (fid != NULL)
p_surface_handle = (intptr_t)(*p_env)->GetIntField(p_env, jsurf, fid);
(*p_env)->DeleteLocalRef(p_env, clz);
......@@ -420,7 +412,7 @@ InitJNIFields(JNIEnv *env, vlc_object_t *p_obj, AWindowHandler *p_awh)
goto end;
#define CHECK_EXCEPTION(what) do { \
if( (*env)->ExceptionOccurred(env) ) \
if( (*env)->ExceptionCheck(env) ) \
{ \
msg_Err(p_obj, "%s failed", what); \
(*env)->ExceptionClear(env); \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment