From: Po Lu Date: Mon, 20 Feb 2023 03:56:13 +0000 (+0800) Subject: Fix crash inside font-list-family X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fecd0a9fed2f392dc0c5f852b705758681ef5266;p=emacs.git Fix crash inside font-list-family * src/androidfont.c (androidfont_list_family): Don't unconditionally initialize the Android font driver. --- diff --git a/src/androidfont.c b/src/androidfont.c index 55f45758352..9da82b670fd 100644 --- a/src/androidfont.c +++ b/src/androidfont.c @@ -1027,18 +1027,19 @@ androidfont_list_family (struct frame *f) jsize i, length; const char *family; - /* Maybe initialize the font driver. */ - androidfont_check_init (); + /* Return if the Android font driver is not initialized. Loading + every font under Android takes a non trivial amount of memory, + and is not something that should be done when the user tries to + list all of the font families. */ + + if (!font_driver) + return Qnil; family_array = (*android_java_env)->CallObjectMethod (android_java_env, font_driver, font_driver_class.list_families); - if (!family_array) - { - (*android_java_env)->ExceptionClear (android_java_env); - memory_full (0); - } + android_exception_check (); length = (*android_java_env)->GetArrayLength (android_java_env, family_array);