app: lock explicitly before refreshing contexts

Signed-off-by: Joe Julian <me@joejulian.name>
This commit is contained in:
Joe Julian
2026-04-21 06:31:35 -07:00
parent dfe4ff0200
commit 7bb7a1407f
4 changed files with 8 additions and 11 deletions
+6 -6
View File
@@ -149,6 +149,12 @@ func (w *Window) validateAndProcess(size image.Point, sync bool, frame *op.Ops,
sync = true
}
}
if w.ctx != nil {
if err := w.ctx.Lock(); err != nil {
w.destroyGPU()
return err
}
}
if sync && w.ctx != nil {
if err := w.ctx.Refresh(); err != nil {
if errors.Is(err, errOutOfDate) {
@@ -163,12 +169,6 @@ func (w *Window) validateAndProcess(size image.Point, sync bool, frame *op.Ops,
return err
}
}
if w.ctx != nil {
if err := w.ctx.Lock(); err != nil {
w.destroyGPU()
return err
}
}
if w.gpu == nil && !w.nocontext {
gpu, err := gpu.New(w.ctx.API())
if err != nil {