ui/app: (wasm) avoid deadlock from focus changes

showTextInput is called from the window loop in window.go, but
could result in an immediate event which then deadlocks waiting for
the window loop to handle it.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-08-02 08:54:21 +02:00
parent 10792f0a00
commit 0be3492e07
+9 -5
View File
@@ -318,11 +318,15 @@ func (w *window) setAnimating(anim bool) {
}
func (w *window) showTextInput(show bool) {
if show {
w.focus()
} else {
w.blur()
}
// Run in a goroutine to avoid a deadlock if the
// focus change result in an event.
go func() {
if show {
w.focus()
} else {
w.blur()
}
}()
}
func (w *window) draw(sync bool) {