< prev index next >

src/java.desktop/unix/native/libawt_xawt/awt/gtk3_interface.c

Print this page
rev 14364 : 8156020: 8145547 breaks AIX and and uses RTLD_NOLOAD incorrectly


  70 static void gtk3_remove_state(GtkWidget *widget, GtkStateType state) {
  71     GtkStateType old_state = fp_gtk_widget_get_state(widget);
  72     fp_gtk_widget_set_state(widget, old_state & ~state);
  73 }
  74 
  75 /* This is a workaround for the bug:
  76  * http://sourceware.org/bugzilla/show_bug.cgi?id=1814
  77  * (dlsym/dlopen clears dlerror state)
  78  * This bug is specific to Linux, but there is no harm in
  79  * applying this workaround on Solaris as well.
  80  */
  81 static void* dl_symbol(const char* name)
  82 {
  83     void* result = dlsym(gtk3_libhandle, name);
  84     if (!result)
  85         longjmp(j, NO_SYMBOL_EXCEPTION);
  86 
  87     return result;
  88 }
  89 
  90 gboolean gtk3_check(const char* lib_name, int flags)
  91 {
  92     if (gtk3_libhandle != NULL) {
  93         /* We've already successfully opened the GTK libs, so return true. */
  94         return TRUE;
  95     } else {
  96         return dlopen(lib_name, flags) != NULL;












  97     }
  98 }
  99 
 100 #define ADD_SUPPORTED_ACTION(actionStr)                                        \
 101 do {                                                                           \
 102     jfieldID fld_action = (*env)->GetStaticFieldID(env, cls_action, actionStr, \
 103                                                  "Ljava/awt/Desktop$Action;"); \
 104     if (!(*env)->ExceptionCheck(env)) {                                        \
 105         jobject action = (*env)->GetStaticObjectField(env, cls_action,         \
 106                                                                   fld_action); \
 107         (*env)->CallBooleanMethod(env, supportedActions, mid_arrayListAdd,     \
 108                                                                       action); \
 109     } else {                                                                   \
 110         (*env)->ExceptionClear(env);                                           \
 111     }                                                                          \
 112 } while(0);
 113 
 114 
 115 static void update_supported_actions(JNIEnv *env) {
 116     GVfs * (*fp_g_vfs_get_default) (void);




  70 static void gtk3_remove_state(GtkWidget *widget, GtkStateType state) {
  71     GtkStateType old_state = fp_gtk_widget_get_state(widget);
  72     fp_gtk_widget_set_state(widget, old_state & ~state);
  73 }
  74 
  75 /* This is a workaround for the bug:
  76  * http://sourceware.org/bugzilla/show_bug.cgi?id=1814
  77  * (dlsym/dlopen clears dlerror state)
  78  * This bug is specific to Linux, but there is no harm in
  79  * applying this workaround on Solaris as well.
  80  */
  81 static void* dl_symbol(const char* name)
  82 {
  83     void* result = dlsym(gtk3_libhandle, name);
  84     if (!result)
  85         longjmp(j, NO_SYMBOL_EXCEPTION);
  86 
  87     return result;
  88 }
  89 
  90 gboolean gtk3_check(const char* lib_name, gboolean load)
  91 {
  92     if (gtk3_libhandle != NULL) {
  93         /* We've already successfully opened the GTK libs, so return true. */
  94         return TRUE;
  95     } else {
  96 #ifdef RTLD_NOLOAD
  97         void *lib = dlopen(lib_name, RTLD_LAZY | RTLD_NOLOAD);
  98         if (!load || lib != NULL) {
  99             return lib != NULL;
 100         }
 101 #else
 102 #ifdef _AIX
 103         /* On AIX we could implement this with the help of loadquery(L_GETINFO, ..)  */
 104         /* (see reload_table() in hotspot/src/os/aix/vm/loadlib_aix.cpp) but it is   */
 105         /* probably not worth it because most AIX servers don't have GTK libs anyway */
 106 #endif
 107 #endif
 108         return dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL) != NULL;
 109     }
 110 }
 111 
 112 #define ADD_SUPPORTED_ACTION(actionStr)                                        \
 113 do {                                                                           \
 114     jfieldID fld_action = (*env)->GetStaticFieldID(env, cls_action, actionStr, \
 115                                                  "Ljava/awt/Desktop$Action;"); \
 116     if (!(*env)->ExceptionCheck(env)) {                                        \
 117         jobject action = (*env)->GetStaticObjectField(env, cls_action,         \
 118                                                                   fld_action); \
 119         (*env)->CallBooleanMethod(env, supportedActions, mid_arrayListAdd,     \
 120                                                                       action); \
 121     } else {                                                                   \
 122         (*env)->ExceptionClear(env);                                           \
 123     }                                                                          \
 124 } while(0);
 125 
 126 
 127 static void update_supported_actions(JNIEnv *env) {
 128     GVfs * (*fp_g_vfs_get_default) (void);


< prev index next >