--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Fri Oct 14 15:37:10 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c Mon Oct 17 09:58:37 2016 +0300
@@ -35,9 +35,6 @@
#include <jni_util.h>
#include "awt.h"
-#define GTHREAD_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gthread-2.0", "0")
-#define GTHREAD_LIB JNI_LIB_NAME("gthread-2.0")
-
#define GTK_TYPE_BORDER ((*fp_gtk_border_get_type)())
#define G_TYPE_FUNDAMENTAL_SHIFT (2)
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h Fri Oct 14 15:37:10 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.h Mon Oct 17 09:58:37 2016 +0300
@@ -449,17 +449,6 @@
static void (*fp_g_list_free) (GList *list);
static void (*fp_g_list_free_full) (GList *list, GDestroyNotify free_func);
-/**
- * This function is available for GLIB > 2.20, so it MUST be
- * called within GLIB_CHECK_VERSION(2, 20, 0) check.
- */
-static gboolean (*fp_g_thread_get_initialized)(void);
-
-static void (*fp_g_thread_init)(GThreadFunctions *vtable);
-static void (*fp_gdk_threads_init)(void);
-static void (*fp_gdk_threads_enter)(void);
-static void (*fp_gdk_threads_leave)(void);
-
static gboolean (*fp_gtk_show_uri)(GdkScreen *screen, const gchar *uri,
guint32 timestamp, GError **error);
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c Fri Oct 14 15:37:10 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c Mon Oct 17 09:58:37 2016 +0300
@@ -35,6 +35,7 @@
#include "awt.h"
static void *gtk3_libhandle = NULL;
+static void *gthread_libhandle = NULL;
static jmp_buf j;
@@ -87,6 +88,15 @@
return result;
}
+static void* dl_symbol_gthread(const char* name)
+{
+ void* result = dlsym(gthread_libhandle, name);
+ if (!result)
+ longjmp(j, NO_SYMBOL_EXCEPTION);
+
+ return result;
+}
+
gboolean gtk3_check(const char* lib_name, gboolean load)
{
if (gtk3_libhandle != NULL) {
@@ -261,6 +271,13 @@
return FALSE;
}
+ gthread_libhandle = dlopen(GTHREAD_LIB_VERSIONED, RTLD_LAZY | RTLD_LOCAL);
+ if (gthread_libhandle == NULL) {
+ gthread_libhandle = dlopen(GTHREAD_LIB, RTLD_LAZY | RTLD_LOCAL);
+ if (gthread_libhandle == NULL)
+ return FALSE;
+ }
+
if (setjmp(j) == 0)
{
fp_gtk_check_version = dl_symbol("gtk_check_version");
@@ -530,8 +547,8 @@
fp_g_path_get_dirname = dl_symbol("g_path_get_dirname");
- fp_gdk_threads_enter = ∅
- fp_gdk_threads_leave = ∅
+ fp_gdk_threads_enter = dl_symbol("gdk_threads_enter");
+ fp_gdk_threads_leave = dl_symbol("gdk_threads_leave");
/**
* Functions for sun_awt_X11_GtkFileDialogPeer.c
@@ -556,6 +573,9 @@
dlclose(gtk3_libhandle);
gtk3_libhandle = NULL;
+ dlclose(gthread_libhandle);
+ gthread_libhandle = NULL;
+
return NULL;
}
@@ -651,6 +671,7 @@
dlerror();
dlclose(gtk3_libhandle);
+ dlclose(gthread_libhandle);
if ((gtk3_error = dlerror()) != NULL)
{
return FALSE;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.h Fri Oct 14 15:37:10 2016 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk_interface.h Mon Oct 17 09:58:37 2016 +0300
@@ -33,6 +33,9 @@
#define TRUE (!FALSE)
#endif
+#define GTHREAD_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gthread-2.0", "0")
+#define GTHREAD_LIB JNI_LIB_NAME("gthread-2.0")
+
#define _G_TYPE_CIC(ip, gt, ct) ((ct*) ip)
#define G_TYPE_CHECK_INSTANCE_CAST(instance, g_type, c_type) \
(_G_TYPE_CIC ((instance), (g_type), c_type))
@@ -555,6 +558,13 @@
gboolean gtk_load(JNIEnv *env, GtkVersion version, gboolean verbose);
gboolean gtk_check_version(GtkVersion version);
+typedef struct _GThreadFunctions GThreadFunctions;
+static gboolean (*fp_g_thread_get_initialized)(void);
+static void (*fp_g_thread_init)(GThreadFunctions *vtable);
+static void (*fp_gdk_threads_init)(void);
+static void (*fp_gdk_threads_enter)(void);
+static void (*fp_gdk_threads_leave)(void);
+
extern GtkApi* gtk;
#endif /* !_GTK_INTERFACE_H */