app: ensure waiting window requests are stopped when a window closes

The Android RegisterFragment method would leak a goroutine if called
after the window was destroyed.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-05-16 11:13:37 +02:00
parent b99151c211
commit e093ea28f7
2 changed files with 20 additions and 7 deletions
+4 -6
View File
@@ -27,10 +27,8 @@ type androidDriver interface {
// and registers it as a Fragment in the Context in which the View was
// created.
func (w *Window) RegisterFragment(del string) {
go func() {
w.driverFuncs <- func() {
d := w.driver.(androidDriver)
d.RegisterFragment(del)
}
}()
w.driverDo(func() {
d := w.driver.(androidDriver)
d.RegisterFragment(del)
})
}