1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-25 06:50:46 -08:00

Fix deadlocks

* java/org/gnu/emacs/EmacsView.java (EmacsView)
(showOnScreenKeyboard, hideOnScreenKeyboard): Don't synchronize.
* java/org/gnu/emacs/EmacsWindow.java (EmacsWindow)
(toggleOnScreenKeyboard): Revert to calling IMM functions from
the main thread.
* src/android.c (struct android_event_container)
(android_pselect_nfds, android_pselect_readfds)
(android_pselect_writefds, android_pselect_exceptfds)
(android_pselect_timeout): Don't make volatile.
(android_wait_event): Run queries if necessary.
This commit is contained in:
Po Lu 2023-06-12 14:19:01 +08:00
parent e3196835ed
commit 3b08bb1318
3 changed files with 39 additions and 21 deletions

View file

@ -590,16 +590,17 @@ public final class EmacsView extends ViewGroup
super.onAttachedToWindow ();
}
public synchronized void
public void
showOnScreenKeyboard ()
{
/* Specifying no flags at all tells the system the user asked for
the input method to be displayed. */
imManager.showSoftInput (this, 0);
isCurrentlyTextEditor = true;
}
public synchronized void
public void
hideOnScreenKeyboard ()
{
imManager.hideSoftInputFromWindow (this.getWindowToken (),

View file

@ -1201,16 +1201,25 @@ public final class EmacsWindow extends EmacsHandleObject
}
public void
toggleOnScreenKeyboard (boolean on)
toggleOnScreenKeyboard (final boolean on)
{
/* InputMethodManager functions are thread safe. Call
`showOnScreenKeyboard' etc from the Emacs thread in order to
keep the calls in sync with updates to the input context. */
/* Even though InputMethodManager functions are thread safe,
`showOnScreenKeyboard' etc must be called from the UI thread in
order to avoid deadlocks if the calls happen in tandem with a
call to a synchronizing function within
`onCreateInputConnection'. */
if (on)
view.showOnScreenKeyboard ();
else
view.hideOnScreenKeyboard ();
EmacsService.SERVICE.runOnUiThread (new Runnable () {
@Override
public void
run ()
{
if (on)
view.showOnScreenKeyboard ();
else
view.hideOnScreenKeyboard ();
}
});
}
public String