mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 02:15:34 +00:00
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:
+3
-1
@@ -394,6 +394,8 @@ func (c *callbacks) SetDriver(d driver) {
|
|||||||
if d == nil {
|
if d == nil {
|
||||||
panic("nil driver")
|
panic("nil driver")
|
||||||
}
|
}
|
||||||
|
c.w.invMu.Lock()
|
||||||
|
defer c.w.invMu.Unlock()
|
||||||
c.w.driver = d
|
c.w.driver = d
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -647,8 +649,8 @@ func (w *Window) processEvent(e event.Event) bool {
|
|||||||
w.destroyGPU()
|
w.destroyGPU()
|
||||||
w.invMu.Lock()
|
w.invMu.Lock()
|
||||||
w.mayInvalidate = false
|
w.mayInvalidate = false
|
||||||
w.invMu.Unlock()
|
|
||||||
w.driver = nil
|
w.driver = nil
|
||||||
|
w.invMu.Unlock()
|
||||||
if q := w.timer.quit; q != nil {
|
if q := w.timer.quit; q != nil {
|
||||||
q <- struct{}{}
|
q <- struct{}{}
|
||||||
<-q
|
<-q
|
||||||
|
|||||||
Reference in New Issue
Block a user