app/headless: avoid race between ReleaseCurrent and MakeCurrent

Release context on MakeCurrent failure paths as well.

Fixes gio#144

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-07-04 17:37:02 +02:00
parent 30ad63283b
commit e2278b64c1
2 changed files with 8 additions and 3 deletions
+3 -2
View File
@@ -139,8 +139,9 @@ func contextDo(ctx context, f func() error) error {
errCh <- err
return
}
defer ctx.ReleaseCurrent()
errCh <- f()
err := f()
ctx.ReleaseCurrent()
errCh <- err
}()
return <-errCh
}