staticint
gdk_android_runtime_exit_looper_cb (int fd, int events, GThread *thread)
{
close (fd);
gint ret = GPOINTER_TO_INT (g_thread_join (thread));
gdk_android_finalize (); // TODO: figure out if it's possible to differentiate between a process // spawned by forking off of zygote and a new process (this usually happens // when using wrap.sh). Processes spawned of zygote have to call _exit, as // it's impossible to exit them cleanly. Newly spawned processes seem to cope // with exit, as long as it is on the main thread. See // https://android.googlesource.com/platform/frameworks/base/+/b5bd3c2/core/java/com/android/internal/os/RuntimeInit.java#376 exit (ret);
}
char arg0[] = "android-gtk"; char *argv[] = { arg0, NULL };
__android_log_print (ANDROID_LOG_DEBUG, "GTK Runtime", "Calling main()"); int ret = data->application_entrypoint (1, argv, environ); // Ideally, this should not be reached as a g_application_hold is active. But in cases where // g_application_quit was called, main shall return. We'll just clean up a bit and then exit // the process to have the OS give us a "clean" process.
__android_log_print (ANDROID_LOG_WARN, "GTK Runtime", "main() returned with %d", ret);
if (!data->available_check_completed)
{
__android_log_print (ANDROID_LOG_ERROR, "GTK Runtime", "GLib eventloop never ran. This is not supposed to happen!");
pthread_barrier_wait (&data->application_available);
}
rc = (*data->vm)->DetachCurrentThread (data->vm); if (rc != JNI_OK)
{
__android_log_print (ANDROID_LOG_ERROR, "GTK Runtime", "Unable to detach thread to JVM: Error %d", rc);
ret = -1;
}
gint exitfd = data->exitfd;
g_free (data);
// If this is reached, we could either attempt to restart the GTK thread, potentially resulting // in an infinite loop in cases where g_application_run immediately exists (like when // g_application_quit has been called) or just exit the process to let the OS handle cleanup && // reinitalization at a later date. // We can only call exit on the main thread (someone probably registered non threadsafe exit // handlers). By closing this exitfd, we signal the looper to join the gtk thread.
close (exitfd); return GINT_TO_POINTER (ret);
}
// This is *really* questionable, as thiz isn't actually an activity. // I've updated the code to handle this case, but it should be replaced // once glib gains java/android support.
gdk_android_set_latest_activity (env, thiz);
if (!g_module_symbol (application, "main", (gpointer *)&data->application_entrypoint))
{
gchar *errmsg = g_strdup_printf ("Unable to find entrypoint \"main\" in application library \"%s\". " "Ensure that the library is correct and the function is visible. " "Perhaps you need to prefix it with G_MODULE_EXPORT?",
g_module_name (application));
(*env)->ThrowNew (env, link_error_class, errmsg);
g_free (errmsg);
if (!gdk_android_initialize (env, class_loader, NULL)) return JNI_ERR;
} else
{
__android_log_print (ANDROID_LOG_INFO, "GTK Runtime", "Did not find \"" RUNTIME_APPLICATION_CLASS "\" in class path, skipping runtime initialization.");
(*env)->ExceptionClear (env);
}
initialized = TRUE; return JNI_VERSION_1_6;
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.12Bemerkung:
(vorverarbeitet am 2026-09-27)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.