src/java.desktop/unix/native/libawt_xawt/awt/awt_InputMethod.c
changeset 55245 e2987b9baa93
parent 54867 65297f60ba19
child 57643 5dae3de0e04b
--- 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();
 }