8074921: OS X build broken by reference to XToolkit
authorazvegint
Wed, 11 Mar 2015 16:48:43 +0300
changeset 29520 2151f4ba1a05
parent 29519 53b8aa64c82d
child 29521 6962c169e541
8074921: OS X build broken by reference to XToolkit Reviewed-by: alexsch, serb
jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java
jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c
--- a/jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java	Tue Mar 10 21:48:37 2015 +0300
+++ b/jdk/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java	Wed Mar 11 16:48:43 2015 +0300
@@ -31,7 +31,6 @@
 import java.security.AccessController;
 import sun.security.action.GetIntegerAction;
 import com.sun.java.swing.plaf.gtk.GTKConstants.TextDirection;
-import sun.awt.X11.XToolkit;
 import sun.java2d.opengl.OGLRenderQueue;
 
 public abstract class UNIXToolkit extends SunToolkit
@@ -98,12 +97,7 @@
     public boolean loadGTK() {
         synchronized (GTK_LOCK) {
             if (nativeGTKLoaded == null) {
-                XToolkit.awtLock();
-                try {
-                    nativeGTKLoaded = load_gtk();
-                } finally {
-                    XToolkit.awtUnlock();
-                }
+                nativeGTKLoaded = load_gtk();
             }
         }
         return nativeGTKLoaded;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Tue Mar 10 21:48:37 2015 +0300
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Wed Mar 11 16:48:43 2015 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 #include "jvm_md.h"
 #include "sizecalc.h"
 #include <jni_util.h>
+#include "awt.h"
 
 #define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
 #define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
@@ -890,6 +891,7 @@
      * BadMatch errors which we would normally ignore. The IO error handler
      * is preserved here, too, just for consistency.
     */
+    AWT_LOCK();
     handler = XSetErrorHandler(NULL);
     io_handler = XSetIOErrorHandler(NULL);
 
@@ -926,6 +928,7 @@
 
     XSetErrorHandler(handler);
     XSetIOErrorHandler(io_handler);
+    AWT_UNLOCK();
 
     /* Initialize widget array. */
     for (i = 0; i < _GTK_WIDGET_TYPE_SIZE; i++)