app: fix race condition between Window.Invalidate and event loop

References: https://todo.sr.ht/~eliasnaur/gio/603
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2024-10-25 20:38:37 +02:00
parent 520efdfa75
commit aa158e0c9c
+3 -1
View File
@@ -394,6 +394,8 @@ func (c *callbacks) SetDriver(d driver) {
if d == nil {
panic("nil driver")
}
c.w.invMu.Lock()
defer c.w.invMu.Unlock()
c.w.driver = d
}
@@ -647,8 +649,8 @@ func (w *Window) processEvent(e event.Event) bool {
w.destroyGPU()
w.invMu.Lock()
w.mayInvalidate = false
w.invMu.Unlock()
w.driver = nil
w.invMu.Unlock()
if q := w.timer.quit; q != nil {
q <- struct{}{}
<-q