mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-01 07:35:40 +00:00
gpu/headless: plug resource leaks in tests
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user