< prev index next >

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

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


 295  * applying this workaround on Solaris as well.
 296  */
 297 static void* dl_symbol(const char* name)
 298 {
 299     void* result = dlsym(gtk2_libhandle, name);
 300     if (!result)
 301         longjmp(j, NO_SYMBOL_EXCEPTION);
 302 
 303     return result;
 304 }
 305 
 306 static void* dl_symbol_gthread(const char* name)
 307 {
 308     void* result = dlsym(gthread_libhandle, name);
 309     if (!result)
 310         longjmp(j, NO_SYMBOL_EXCEPTION);
 311 
 312     return result;
 313 }
 314 
 315 gboolean gtk2_check(const char* lib_name, int flags)
 316 {
 317     if (gtk2_libhandle != NULL) {
 318         /* We've already successfully opened the GTK libs, so return true. */
 319         return TRUE;
 320     } else {
 321         void *lib = NULL;
 322 
 323         lib = dlopen(lib_name, flags);












 324 

 325         if (lib == NULL) {
 326             return FALSE;
 327         }
 328 
 329         if (flags & RTLD_NOLOAD) {
 330             return TRUE;
 331         }
 332 
 333         fp_gtk_check_version = dlsym(lib, "gtk_check_version");
 334         /* Check for GTK 2.2+ */
 335         if (!fp_gtk_check_version(2, 2, 0)) {
 336             return TRUE;
 337         }
 338 
 339         // 8048289: workaround for https://bugzilla.gnome.org/show_bug.cgi?id=733065
 340         // dlclose(lib);
 341 
 342         return FALSE;
 343     }
 344 }
 345 
 346 #define ADD_SUPPORTED_ACTION(actionStr) \
 347 do { \
 348     jfieldID fld_action = (*env)->GetStaticFieldID(env, cls_action, actionStr, "Ljava/awt/Desktop$Action;"); \
 349     if (!(*env)->ExceptionCheck(env)) { \
 350         jobject action = (*env)->GetStaticObjectField(env, cls_action, fld_action); \




 295  * applying this workaround on Solaris as well.
 296  */
 297 static void* dl_symbol(const char* name)
 298 {
 299     void* result = dlsym(gtk2_libhandle, name);
 300     if (!result)
 301         longjmp(j, NO_SYMBOL_EXCEPTION);
 302 
 303     return result;
 304 }
 305 
 306 static void* dl_symbol_gthread(const char* name)
 307 {
 308     void* result = dlsym(gthread_libhandle, name);
 309     if (!result)
 310         longjmp(j, NO_SYMBOL_EXCEPTION);
 311 
 312     return result;
 313 }
 314 
 315 gboolean gtk2_check(const char* lib_name, gboolean load)
 316 {
 317     if (gtk2_libhandle != NULL) {
 318         /* We've already successfully opened the GTK libs, so return true. */
 319         return TRUE;
 320     } else {
 321         void *lib = NULL;
 322 
 323 #ifdef RTLD_NOLOAD
 324         /* Just check if gtk libs are already in the process space */
 325         lib = dlopen(lib_name, RTLD_LAZY | RTLD_NOLOAD);
 326         if (!load || lib != NULL) {
 327             return lib != NULL;
 328         }
 329 #else
 330 #ifdef _AIX
 331         /* On AIX we could implement this with the help of loadquery(L_GETINFO, ..)  */
 332         /* (see reload_table() in hotspot/src/os/aix/vm/loadlib_aix.cpp) but it is   */
 333         /* probably not worth it because most AIX servers don't have GTK libs anyway */
 334 #endif
 335 #endif
 336 
 337         lib = dlopen(lib_name, RTLD_LAZY | RTLD_LOCAL);
 338         if (lib == NULL) {
 339             return FALSE;




 340         }
 341 
 342         fp_gtk_check_version = dlsym(lib, "gtk_check_version");
 343         /* Check for GTK 2.2+ */
 344         if (!fp_gtk_check_version(2, 2, 0)) {
 345             return TRUE;
 346         }
 347 
 348         // 8048289: workaround for https://bugzilla.gnome.org/show_bug.cgi?id=733065
 349         // dlclose(lib);
 350 
 351         return FALSE;
 352     }
 353 }
 354 
 355 #define ADD_SUPPORTED_ACTION(actionStr) \
 356 do { \
 357     jfieldID fld_action = (*env)->GetStaticFieldID(env, cls_action, actionStr, "Ljava/awt/Desktop$Action;"); \
 358     if (!(*env)->ExceptionCheck(env)) { \
 359         jobject action = (*env)->GetStaticObjectField(env, cls_action, fld_action); \


< prev index next >