8029923: Many Swing tests and SwingSet2 are failing under Solaris using GTK LaF - "Unable to load native GTK libraries"

Reviewed-by: anthony, serb
This commit is contained in:
Alexander Zvegintsev 2013-12-18 10:41:11 +00:00
parent b031d0e4ea
commit bbcac040a5
2 changed files with 16 additions and 4 deletions

View File

@ -533,7 +533,10 @@ gboolean gtk2_load(JNIEnv *env)
} }
/* GLib */ /* 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_free = dl_symbol("g_free");
fp_g_object_unref = dl_symbol("g_object_unref"); fp_g_object_unref = dl_symbol("g_object_unref");
@ -709,7 +712,7 @@ gboolean gtk2_load(JNIEnv *env)
/** /**
* GLib thread system * 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_get_initialized = dl_symbol_gthread("g_thread_get_initialized");
} }
fp_g_thread_init = dl_symbol_gthread("g_thread_init"); 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 // We can use g_thread_get_initialized () but it is available only for
// GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20. // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
gboolean is_g_thread_get_initialized = FALSE; 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(); is_g_thread_get_initialized = fp_g_thread_get_initialized();
} }

View File

@ -647,10 +647,19 @@ const char *getStrFor(JNIEnv *env, jstring value);
* Returns : * Returns :
* NULL if the GLib library is compatible with the given version, or a string * NULL if the GLib library is compatible with the given version, or a string
* describing the version mismatch. * 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, gchar* (*fp_glib_check_version)(guint required_major, guint required_minor,
guint required_micro); 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 * Check whether the gtk2 library is available and meets the minimum
* version requirement. If the library is already loaded this method has no * 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 * 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); gboolean (*fp_g_thread_get_initialized)(void);