gpu/headless: plug resource leaks in tests

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2021-09-20 13:03:29 +02:00
parent 18c2ba8e20
commit 78b6268f9b
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -212,6 +212,7 @@ func newDriver(t *testing.T) driver.Device {
b.BeginFrame(nil, true, image.Pt(1, 1))
t.Cleanup(func() {
b.EndFrame()
b.Release()
ctx.ReleaseCurrent()
runtime.UnlockOSThread()
ctx.Release()
+5
View File
@@ -66,6 +66,7 @@ func NewWindow(width, height int) (*Window, error) {
if err != nil {
fbo.Release()
fboTex.Release()
dev.Release()
return err
}
w.fboTex = fboTex
@@ -96,6 +97,10 @@ func (w *Window) Release() {
w.gpu.Release()
w.gpu = nil
}
if w.dev != nil {
w.dev.Release()
w.dev = nil
}
return nil
})
if w.ctx != nil {