JRE-254 JRE fatal error when pick up foreground color in Color&Fonts settings

Backported jdk9 fix:

changeset:   12655:b062834de9bc
parent:      12611:daf91fa9bd3b
user:        azvegint
date:        Fri Aug 21 10:43:47 2015 -0700
summary:     8134028: [PIT] XToolkit, strange behavior of robot.createScreenCapture(): looks like a native crash in X11/GTK

(cherry picked from commit 07aca87)
diff --git a/src/solaris/native/sun/awt/awt_Robot.c b/src/solaris/native/sun/awt/awt_Robot.c
index 77aa884..eed0a4e 100644
--- a/src/solaris/native/sun/awt/awt_Robot.c
+++ b/src/solaris/native/sun/awt/awt_Robot.c
@@ -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) {