]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent reporting of crashes when Emacs is restarted on Android
authorPo Lu <luangruo@yahoo.com>
Fri, 3 May 2024 02:43:31 +0000 (10:43 +0800)
committerEshel Yaron <me@eshelyaron.com>
Mon, 6 May 2024 16:36:39 +0000 (18:36 +0200)
* src/emacs.c (Fkill_emacs): Ignore SIGBUS and SIGSGEV
immediately before calling exit.

(cherry picked from commit 6171a9a628fb71b172598c7d7bbea8448ee251d6)

src/emacs.c

index 1cb1e70ac65eb773cba64d809b0b91a7a1473bc4..7431cef274d8786a4c09bc0cc3b955ac1b9d55ef 100644 (file)
@@ -2999,6 +2999,21 @@ killed.  */
 #ifdef HAVE_NATIVE_COMP
   eln_load_path_final_clean_up ();
 #endif
+#if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
+  if (android_init_gui)
+    {
+      /* Calls to exit may be followed by illegal accesses from
+        toolkit-managed threads as the thread group is destroyed, which
+        are inconsequential when the process is being terminated, but
+        which must be suppressed to inhibit reporting of superfluous
+        crashes by the system.
+
+         Execution won't return to Emacs whatever the value of RESTART,
+         as `android_restart_emacs' will only ever abort or succeed.  */
+      signal (SIGBUS, SIG_IGN);
+      signal (SIGSEGV, SIG_IGN);
+    }
+#endif /* HAVE_ANDROID && !ANDROID_STUBIFY */
 
   if (!NILP (restart))
     {