mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 18:05:35 +00:00
app: don't deadlock if Window.validateAndProcess fails
Fixes: https://todo.sr.ht/~eliasnaur/gio/417 Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+13
-5
@@ -178,7 +178,16 @@ func (w *Window) update(frame *op.Ops) {
|
|||||||
<-w.frameAck
|
<-w.frameAck
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *Window) validateAndProcess(d driver, size image.Point, sync bool, frame *op.Ops, signal chan<- struct{}) error {
|
func (w *Window) validateAndProcess(d driver, size image.Point, sync bool, frame *op.Ops, sigChan chan<- struct{}) error {
|
||||||
|
signal := func() {
|
||||||
|
if sigChan != nil {
|
||||||
|
// We're done with frame, let the client continue.
|
||||||
|
sigChan <- struct{}{}
|
||||||
|
// Signal at most once.
|
||||||
|
sigChan = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
defer signal()
|
||||||
for {
|
for {
|
||||||
if w.gpu == nil && !w.nocontext {
|
if w.gpu == nil && !w.nocontext {
|
||||||
var err error
|
var err error
|
||||||
@@ -235,10 +244,9 @@ func (w *Window) validateAndProcess(d driver, size image.Point, sync bool, frame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
w.queue.q.Frame(frame)
|
w.queue.q.Frame(frame)
|
||||||
// We're done with frame, let the client continue.
|
// Let the client continue as soon as possible, in particular before
|
||||||
if signal != nil {
|
// a potentially blocking Present.
|
||||||
signal <- struct{}{}
|
signal()
|
||||||
}
|
|
||||||
var err error
|
var err error
|
||||||
if w.gpu != nil {
|
if w.gpu != nil {
|
||||||
err = w.ctx.Present()
|
err = w.ctx.Present()
|
||||||
|
|||||||
Reference in New Issue
Block a user