From 90c6b1020f354b5b3512fac4953e955c09bd19c3 Mon Sep 17 00:00:00 2001 From: azvegint Date: Fri, 13 Dec 2013 14:29:17 +0400 Subject: [PATCH] 8029923: Many Swing tests and SwingSet2 are failing under Solaris using GTK LaF - "Unable to load native GTK libraries" Reviewed-by: anthony, serb --- src/solaris/native/sun/awt/gtk2_interface.c | 9 ++++++--- src/solaris/native/sun/awt/gtk2_interface.h | 11 ++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/solaris/native/sun/awt/gtk2_interface.c b/src/solaris/native/sun/awt/gtk2_interface.c index cb960b128..d19bcefed 100644 --- a/src/solaris/native/sun/awt/gtk2_interface.c +++ b/src/solaris/native/sun/awt/gtk2_interface.c @@ -533,7 +533,10 @@ gboolean gtk2_load(JNIEnv *env) } /* 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 @@ gboolean gtk2_load(JNIEnv *env) /** * 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 @@ gboolean gtk2_load(JNIEnv *env) // 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(); } diff --git a/src/solaris/native/sun/awt/gtk2_interface.h b/src/solaris/native/sun/awt/gtk2_interface.h index c8fe45360..beb020cc1 100644 --- a/src/solaris/native/sun/awt/gtk2_interface.h +++ b/src/solaris/native/sun/awt/gtk2_interface.h @@ -647,10 +647,19 @@ const char *getStrFor(JNIEnv *env, jstring value); * 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 @@ guint (*fp_gtk_main_level)(void); /** * 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); -- GitLab