8134028: [PIT] XToolkit, strange behavior of robot.createScreenCapture(): looks like a native crash in X11/GTK
Reviewed-by: alexsch, serb
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c Mon Aug 17 10:12:16 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c Fri Aug 21 10:43:47 2015 -0700
@@ -259,6 +259,7 @@
if (isGtkSupported) {
GdkPixbuf *pixbuf;
+ (*fp_gdk_threads_enter)();
GdkWindow *root = (*fp_gdk_get_default_root_window)();
pixbuf = (*fp_gdk_pixbuf_get_from_drawable)(NULL, root, NULL,
@@ -279,6 +280,7 @@
ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL);
if (!ary) {
(*fp_g_object_unref)(pixbuf);
+ (*fp_gdk_threads_leave)();
AWT_UNLOCK();
return;
}
@@ -298,6 +300,7 @@
(*env)->ReleasePrimitiveArrayCritical(env, pixelArray, ary, 0);
if ((*env)->ExceptionCheck(env)) {
(*fp_g_object_unref)(pixbuf);
+ (*fp_gdk_threads_leave)();
AWT_UNLOCK();
return;
}
@@ -305,6 +308,7 @@
}
(*fp_g_object_unref)(pixbuf);
}
+ (*fp_gdk_threads_leave)();
}
if (gtk_failed) {