emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

feature/android fecd0a9fed2 1/3: Fix crash inside font-list-family


From: Po Lu
Subject: feature/android fecd0a9fed2 1/3: Fix crash inside font-list-family
Date: Mon, 20 Feb 2023 09:16:21 -0500 (EST)

branch: feature/android
commit fecd0a9fed2f392dc0c5f852b705758681ef5266
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Fix crash inside font-list-family
    
    * src/androidfont.c (androidfont_list_family): Don't
    unconditionally initialize the Android font driver.
---
 src/androidfont.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

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);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]