changeset 12645:b062834de9bc

8134028: [PIT] XToolkit, strange behavior of robot.createScreenCapture(): looks like a native crash in X11/GTK Reviewed-by: alexsch, serb
author azvegint
date Fri, 21 Aug 2015 10:43:47 -0700
parents daf91fa9bd3b
children 7abcba76f5e6
files src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c	Mon Aug 17 10:12:16 2015 -0700
+++ b/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) {