8164321: Crash of SwingNode with GTK LaF
Reviewed-by: azvegint, alexsch
This commit is contained in:
parent
0d34edc708
commit
b3d5aa622e
@ -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)
|
||||
|
@ -449,17 +449,6 @@ static GList* (*fp_g_list_append) (GList *list, gpointer data);
|
||||
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);
|
||||
|
||||
|
@ -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 @@ static void* dl_symbol(const char* name)
|
||||
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 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
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 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
|
||||
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 @@ GtkApi* gtk3_load(JNIEnv *env, const char* lib_name)
|
||||
dlclose(gtk3_libhandle);
|
||||
gtk3_libhandle = NULL;
|
||||
|
||||
dlclose(gthread_libhandle);
|
||||
gthread_libhandle = NULL;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -651,6 +671,7 @@ static int gtk3_unload()
|
||||
|
||||
dlerror();
|
||||
dlclose(gtk3_libhandle);
|
||||
dlclose(gthread_libhandle);
|
||||
if ((gtk3_error = dlerror()) != NULL)
|
||||
{
|
||||
return FALSE;
|
||||
|
@ -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 @@ typedef struct GtkApi {
|
||||
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 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user