aboutsummaryrefslogtreecommitdiffstats
path: root/src/android.c
diff options
context:
space:
mode:
authorPo Lu2024-01-26 11:24:51 +0800
committerPo Lu2024-01-26 11:24:51 +0800
commit16831e290ed29f5f70dfe144ec63c583527485e8 (patch)
treeeecc1f3de356aa04a82f4687d7dac4303282ea77 /src/android.c
parent65829b27ca4898ff0905a8124980243977a1382f (diff)
downloademacs-16831e290ed29f5f70dfe144ec63c583527485e8.tar.gz
emacs-16831e290ed29f5f70dfe144ec63c583527485e8.zip
Avert race condition between window attachment and buffer swap
* java/org/gnu/emacs/EmacsView.java (swapBuffers): Synchronize such that code cannot execute between the bitmap's being loaded and being transferred to surfaceView. (onDetachedFromWindow): Recycle bitmap after the surface view is reset. * java/org/gnu/emacs/EmacsWindow.java (recreateActivity): * src/android.c (android_init_emacs_window) (android_recreate_activity): * src/androidfns.c (Fandroid_recreate_activity) (syms_of_androidfns): New functions for debugging window attachment. * src/androidgui.h: Update prototypes.
Diffstat (limited to 'src/android.c')
-rw-r--r--src/android.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/android.c b/src/android.c
index 509f30a759b..51eb85a97e8 100644
--- a/src/android.c
+++ b/src/android.c
@@ -111,6 +111,7 @@ struct android_emacs_window
111 jmethodID set_dont_focus_on_map; 111 jmethodID set_dont_focus_on_map;
112 jmethodID define_cursor; 112 jmethodID define_cursor;
113 jmethodID damage_rect; 113 jmethodID damage_rect;
114 jmethodID recreate_activity;
114}; 115};
115 116
116struct android_emacs_cursor 117struct android_emacs_cursor
@@ -1802,12 +1803,12 @@ android_init_emacs_window (void)
1802 FIND_METHOD (set_dont_accept_focus, "setDontAcceptFocus", "(Z)V"); 1803 FIND_METHOD (set_dont_accept_focus, "setDontAcceptFocus", "(Z)V");
1803 FIND_METHOD (define_cursor, "defineCursor", 1804 FIND_METHOD (define_cursor, "defineCursor",
1804 "(Lorg/gnu/emacs/EmacsCursor;)V"); 1805 "(Lorg/gnu/emacs/EmacsCursor;)V");
1805
1806 /* In spite of the declaration of this function being located within 1806 /* In spite of the declaration of this function being located within
1807 EmacsDrawable, the ID of the `damage_rect' method is retrieved 1807 EmacsDrawable, the ID of the `damage_rect' method is retrieved
1808 from EmacsWindow, which avoids virtual function dispatch within 1808 from EmacsWindow, which avoids virtual function dispatch within
1809 android_damage_window. */ 1809 android_damage_window. */
1810 FIND_METHOD (damage_rect, "damageRect", "(IIII)V"); 1810 FIND_METHOD (damage_rect, "damageRect", "(IIII)V");
1811 FIND_METHOD (recreate_activity, "recreateActivity", "()V");
1811#undef FIND_METHOD 1812#undef FIND_METHOD
1812} 1813}
1813 1814
@@ -6638,6 +6639,24 @@ android_request_storage_access (void)
6638 android_exception_check (); 6639 android_exception_check ();
6639} 6640}
6640 6641
6642/* Recreate the activity to which WINDOW is attached to debug graphics
6643 code executed in response to window attachment. */
6644
6645void
6646android_recreate_activity (android_window window)
6647{
6648 jobject object;
6649 jmethodID method;
6650
6651 object = android_resolve_handle (window, ANDROID_HANDLE_WINDOW);
6652 method = window_class.recreate_activity;
6653
6654 (*android_java_env)->CallNonvirtualVoidMethod (android_java_env, object,
6655 window_class.class,
6656 method);
6657 android_exception_check ();
6658}
6659
6641 6660
6642 6661
6643/* The thread from which a query against a thread is currently being 6662/* The thread from which a query against a thread is currently being