]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix failure of `restart-emacs' to restart Emacs on Android
authorPo Lu <luangruo@yahoo.com>
Tue, 14 May 2024 02:16:18 +0000 (10:16 +0800)
committerEshel Yaron <me@eshelyaron.com>
Thu, 16 May 2024 08:19:01 +0000 (10:19 +0200)
* src/emacs.c (Fkill_emacs) [HAVE_ANDROID && !ANDROID_STUBIFY]:
Arrange to terminate Emacs upon receipt of a bus error.

(cherry picked from commit fff245c52931fc829877ae379e48b373c15a1dcb)

src/emacs.c

index 58c751eaa6adbbe0add00089de146dc2dbe5fa76..f122955884eceb0ef25710738cda78b3ef04cbdb 100644 (file)
@@ -3005,7 +3005,9 @@ killed.  */
 #if defined HAVE_ANDROID && !defined ANDROID_STUBIFY
   if (android_init_gui)
     {
-      /* Calls to exit may be followed by illegal accesses from
+      struct sigaction sa;
+
+      /* Calls to exit may be followed by invalid 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
@@ -3013,8 +3015,10 @@ killed.  */
 
          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);
+      sigemptyset (&sa.sa_mask);
+      sa.sa_handler = _exit;
+      sigaction (SIGSEGV, &sa, NULL);
+      sigaction (SIGBUS, &sa, NULL);
     }
 #endif /* HAVE_ANDROID && !ANDROID_STUBIFY */