8225182: JNI exception pending in DestroyXIMCallback of awt_InputMethod.c:1327
authornaoto
Wed, 05 Jun 2019 16:10:08 -0700
changeset 55245 e2987b9baa93
parent 55244 0d326e0f474c
child 55246 184b05daf50f
8225182: JNI exception pending in DestroyXIMCallback of awt_InputMethod.c:1327 Reviewed-by: serb
src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c	Wed Jun 05 17:01:43 2019 -0400
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c	Wed Jun 05 16:10:08 2019 -0700
@@ -1329,7 +1329,15 @@
     /* free the old pX11IMData and set it to null. this also avoids crashing
      * the jvm if the XIM server reappears */
     while (x11InputMethodGRefListHead != NULL) {
-        getX11InputMethodData(env, x11InputMethodGRefListHead->inputMethodGRef);
+        if (getX11InputMethodData(env,
+                x11InputMethodGRefListHead->inputMethodGRef) == NULL) {
+            /* Clear possible exceptions
+             */
+            if ((*env)->ExceptionOccurred(env)) {
+                (*env)->ExceptionDescribe(env);
+                (*env)->ExceptionClear(env);
+            }
+        }
     }
     AWT_UNLOCK();
 }