1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-01 01:41:01 -08:00

Prevent crashes and related issues if initial activity is destroyed on Android

* java/org/gnu/emacs/EmacsWindow.java
(EmacsWindow) <initialWindowCreated>: New variable.
(EmacsWindow): If the initial frame has not yet been created,
set attachmentToken to -1.

* java/org/gnu/emacs/EmacsWindowManager.java (registerWindow):
When the window's attachment token is -1 (i.e., it is the
default window), start EmacsActivity rather than
EmacsMultitaskActivity.  Catch exceptions around startActivity.
This commit is contained in:
Po Lu 2024-06-27 11:06:59 +08:00
parent d5c6eb1f96
commit 860840621a
2 changed files with 47 additions and 7 deletions

View file

@ -74,6 +74,9 @@ public final class EmacsWindow extends EmacsHandleObject
{
private static final String TAG = "EmacsWindow";
/* Whether any windows have yet been created in this session. */
private static boolean initialWindowCreated;
private static class Coordinate
{
/* Integral coordinate. */
@ -192,6 +195,14 @@ public final class EmacsWindow extends EmacsHandleObject
this.parent = parent;
this.overrideRedirect = overrideRedirect;
/* The initial frame should always be bound to the startup
activity. */
if (!initialWindowCreated)
{
this.attachmentToken = -1;
initialWindowCreated = true;
}
/* Create the list of children. */
children = new ArrayList<EmacsWindow> ();