[vlc-commits] android_utils: use ExceptionCheck

Thomas Guillem git at videolan.org
Thu Nov 12 10:54:06 CET 2015


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Nov 12 10:33:49 2015 +0100| [f92071359673632c5bc8245084468dd604c8a30b] | committer: 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).

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f92071359673632c5bc8245084468dd604c8a30b
---

 modules/video_output/android/utils.c |   16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/modules/video_output/android/utils.c b/modules/video_output/android/utils.c
index 30ee92c..abd063a 100644
--- a/modules/video_output/android/utils.c
+++ b/modules/video_output/android/utils.c
@@ -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,21 +129,13 @@ 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)
@@ -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); \



More information about the vlc-commits mailing list