8029923: Many Swing tests and SwingSet2 are failing under Solaris using GTK LaF - "Unable to load native GTK libraries"
authorazvegint
Wed, 18 Dec 2013 10:41:11 +0000
changeset 23242 3ebc2cd4845d
parent 23241 e59e85da457f
child 23243 43e5bc27297f
8029923: Many Swing tests and SwingSet2 are failing under Solaris using GTK LaF - "Unable to load native GTK libraries" Reviewed-by: anthony, serb
jdk/src/solaris/native/sun/awt/gtk2_interface.c
jdk/src/solaris/native/sun/awt/gtk2_interface.h
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Tue Dec 17 18:41:58 2013 +0400
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c	Wed Dec 18 10:41:11 2013 +0000
@@ -533,7 +533,10 @@
         }
 
         /* GLib */
-        fp_glib_check_version = dl_symbol("glib_check_version");
+        fp_glib_check_version = dlsym(gtk2_libhandle, "glib_check_version");
+        if (!fp_glib_check_version) {
+            dlerror();
+        }
         fp_g_free = dl_symbol("g_free");
         fp_g_object_unref = dl_symbol("g_object_unref");
 
@@ -709,7 +712,7 @@
         /**
          * GLib thread system
          */
-        if (fp_glib_check_version(2, 20, 0) == NULL) {
+        if (GLIB_CHECK_VERSION(2, 20, 0)) {
             fp_g_thread_get_initialized = dl_symbol_gthread("g_thread_get_initialized");
         }
         fp_g_thread_init = dl_symbol_gthread("g_thread_init");
@@ -827,7 +830,7 @@
         // We can use g_thread_get_initialized () but it is available only for
         // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
         gboolean is_g_thread_get_initialized = FALSE;
-        if (fp_glib_check_version(2, 20, 0) == NULL) {
+        if (GLIB_CHECK_VERSION(2, 20, 0)) {
             is_g_thread_get_initialized = fp_g_thread_get_initialized();
         }
 
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Tue Dec 17 18:41:58 2013 +0400
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.h	Wed Dec 18 10:41:11 2013 +0000
@@ -647,10 +647,19 @@
  * Returns :
  * NULL if the GLib library is compatible with the given version, or a string
  * describing the version mismatch.
+ * Please note that the glib_check_version() is available since 2.6,
+ * so you should use GLIB_CHECK_VERSION macro instead.
  */
 gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
                        guint required_micro);
 
+/**
+ * Returns :
+ *  TRUE if the GLib library is compatible with the given version
+ */
+#define GLIB_CHECK_VERSION(major, minor, micro) \
+    (fp_glib_check_version && fp_glib_check_version(major, minor, micro) == NULL)
+
 /*
  * Check whether the gtk2 library is available and meets the minimum
  * version requirement.  If the library is already loaded this method has no
@@ -811,7 +820,7 @@
 
 /**
  * This function is available for GLIB > 2.20, so it MUST be
- * called within (fp_glib_check_version(2, 20, 0) == NULL) check.
+ * called within GLIB_CHECK_VERSION(2, 20, 0) check.
  */
 gboolean (*fp_g_thread_get_initialized)(void);