forked from joejulian/gio
ui/app: remove IsAlive
IsAlive races with the StageDead event: if the client checks IsAlive after the stage is updated to StageDead but before having received the StageDead it will exit the event loop, blocking the StageDead to ever arrive. Remove IsAlive and let the client rely only on the StageDead to exit its event loop. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+5
-8
@@ -79,14 +79,17 @@ func (w *Window) Timings() string {
|
||||
}
|
||||
|
||||
func (w *Window) SetTextInput(s key.TextInputState) {
|
||||
if !w.IsAlive() {
|
||||
w.mu.Lock()
|
||||
defer w.mu.Unlock()
|
||||
if !w.isAlive() {
|
||||
return
|
||||
}
|
||||
if s != w.inputState && (s == key.TextInputClose || s == key.TextInputOpen) {
|
||||
w.driver.setTextInput(s)
|
||||
}
|
||||
if s == key.TextInputFocus {
|
||||
w.Redraw()
|
||||
w.setNextFrame(time.Time{})
|
||||
w.updateAnimation()
|
||||
}
|
||||
w.inputState = s
|
||||
}
|
||||
@@ -221,12 +224,6 @@ func (w *Window) Stage() Stage {
|
||||
return w.stage
|
||||
}
|
||||
|
||||
func (w *Window) IsAlive() bool {
|
||||
w.mu.Lock()
|
||||
defer w.mu.Unlock()
|
||||
return w.isAlive()
|
||||
}
|
||||
|
||||
func (w *Window) isAlive() bool {
|
||||
return w.stage > StageDead && w.err == nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user