< prev index next >

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

Print this page




 800             }
 801             putenv (new_env);
 802             free (new_env);
 803             free (tmp_env);
 804         }
 805     }
 806 
 807     /*
 808      * GTK should be initialized with gtk_init_check() before use.
 809      *
 810      * gtk_init_check installs its own error handlers. It is critical that
 811      * we preserve error handler set from AWT. Otherwise we'll crash on
 812      * BadMatch errors which we would normally ignore. The IO error handler
 813      * is preserved here, too, just for consistency.
 814     */
 815     AWT_LOCK();
 816     handler = XSetErrorHandler(NULL);
 817     io_handler = XSetIOErrorHandler(NULL);
 818 
 819     if (fp_gtk_check_version(2, 2, 0) == NULL) {
 820         jclass clazz = (*env)->FindClass(env, "sun/misc/GThreadHelper");
 821         jmethodID mid_getAndSetInitializationNeededFlag =
 822                 (*env)->GetStaticMethodID(env, clazz, "getAndSetInitializationNeededFlag", "()Z");
 823         jmethodID mid_lock = (*env)->GetStaticMethodID(env, clazz, "lock", "()V");
 824         jmethodID mid_unlock = (*env)->GetStaticMethodID(env, clazz, "unlock", "()V");
 825 
 826         // Init the thread system to use GLib in a thread-safe mode
 827         (*env)->CallStaticVoidMethod(env, clazz, mid_lock);
 828         if ((*env)->ExceptionCheck(env)) {
 829             AWT_UNLOCK();
 830             return FALSE;
 831         }
 832 
 833         // Calling g_thread_init() multiple times leads to crash on GLib < 2.24
 834         // We can use g_thread_get_initialized () but it is available only for
 835         // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
 836         gboolean is_g_thread_get_initialized = FALSE;
 837         if (GLIB_CHECK_VERSION(2, 20, 0)) {
 838             is_g_thread_get_initialized = fp_g_thread_get_initialized();
 839         }
 840 




 800             }
 801             putenv (new_env);
 802             free (new_env);
 803             free (tmp_env);
 804         }
 805     }
 806 
 807     /*
 808      * GTK should be initialized with gtk_init_check() before use.
 809      *
 810      * gtk_init_check installs its own error handlers. It is critical that
 811      * we preserve error handler set from AWT. Otherwise we'll crash on
 812      * BadMatch errors which we would normally ignore. The IO error handler
 813      * is preserved here, too, just for consistency.
 814     */
 815     AWT_LOCK();
 816     handler = XSetErrorHandler(NULL);
 817     io_handler = XSetIOErrorHandler(NULL);
 818 
 819     if (fp_gtk_check_version(2, 2, 0) == NULL) {
 820         jclass clazz = (*env)->FindClass(env, "sun/awt/GThreadHelper");
 821         jmethodID mid_getAndSetInitializationNeededFlag =
 822                 (*env)->GetStaticMethodID(env, clazz, "getAndSetInitializationNeededFlag", "()Z");
 823         jmethodID mid_lock = (*env)->GetStaticMethodID(env, clazz, "lock", "()V");
 824         jmethodID mid_unlock = (*env)->GetStaticMethodID(env, clazz, "unlock", "()V");
 825 
 826         // Init the thread system to use GLib in a thread-safe mode
 827         (*env)->CallStaticVoidMethod(env, clazz, mid_lock);
 828         if ((*env)->ExceptionCheck(env)) {
 829             AWT_UNLOCK();
 830             return FALSE;
 831         }
 832 
 833         // Calling g_thread_init() multiple times leads to crash on GLib < 2.24
 834         // We can use g_thread_get_initialized () but it is available only for
 835         // GLib >= 2.20. We rely on GThreadHelper for GLib < 2.20.
 836         gboolean is_g_thread_get_initialized = FALSE;
 837         if (GLIB_CHECK_VERSION(2, 20, 0)) {
 838             is_g_thread_get_initialized = fp_g_thread_get_initialized();
 839         }
 840 


< prev index next >