mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 10:25:37 +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))
|
b.BeginFrame(nil, true, image.Pt(1, 1))
|
||||||
t.Cleanup(func() {
|
t.Cleanup(func() {
|
||||||
b.EndFrame()
|
b.EndFrame()
|
||||||
|
b.Release()
|
||||||
ctx.ReleaseCurrent()
|
ctx.ReleaseCurrent()
|
||||||
runtime.UnlockOSThread()
|
runtime.UnlockOSThread()
|
||||||
ctx.Release()
|
ctx.Release()
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ func NewWindow(width, height int) (*Window, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
fbo.Release()
|
fbo.Release()
|
||||||
fboTex.Release()
|
fboTex.Release()
|
||||||
|
dev.Release()
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
w.fboTex = fboTex
|
w.fboTex = fboTex
|
||||||
@@ -96,6 +97,10 @@ func (w *Window) Release() {
|
|||||||
w.gpu.Release()
|
w.gpu.Release()
|
||||||
w.gpu = nil
|
w.gpu = nil
|
||||||
}
|
}
|
||||||
|
if w.dev != nil {
|
||||||
|
w.dev.Release()
|
||||||
|
w.dev = nil
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if w.ctx != nil {
|
if w.ctx != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user