8225182: JNI exception pending in DestroyXIMCallback of awt_InputMethod.c:1327
Reviewed-by: serb
--- 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();
}