< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/awt_Robot.c

Print this page

        

@@ -257,10 +257,11 @@
 
     int index;
 
     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,
                                                     x, y, 0, 0, width, height);
 

@@ -277,10 +278,11 @@
                 guchar *p, *pix = (*fp_gdk_pixbuf_get_pixels)(pixbuf);
 
                 ary = (*env)->GetPrimitiveArrayCritical(env, pixelArray, NULL);
                 if (!ary) {
                     (*fp_g_object_unref)(pixbuf);
+                    (*fp_gdk_threads_leave)();
                     AWT_UNLOCK();
                     return;
                 }
 
                 for (_y = 0; _y < height; _y++) {

@@ -296,17 +298,19 @@
                     }
                 }
                 (*env)->ReleasePrimitiveArrayCritical(env, pixelArray, ary, 0);
                 if ((*env)->ExceptionCheck(env)) {
                     (*fp_g_object_unref)(pixbuf);
+                    (*fp_gdk_threads_leave)();
                     AWT_UNLOCK();
                     return;
                 }
                 gtk_failed = FALSE;
             }
             (*fp_g_object_unref)(pixbuf);
         }
+        (*fp_gdk_threads_leave)();
     }
 
     if (gtk_failed) {
         image = getWindowImage(awt_display, rootWindow, x, y, width, height);
 
< prev index next >