jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c
changeset 41792 8b032394d44e
parent 39845 9a6e55dd0aeb
child 42455 a66ed8458668
--- 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;