mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
shareable: Bug fix: Call SetFinalizer whenever a new image is created
Fixes #637
This commit is contained in:
parent
f765966742
commit
abdf52bc74
@ -277,6 +277,7 @@ func (i *Image) allocate(shareable bool) {
|
|||||||
i.backend = &backend{
|
i.backend = &backend{
|
||||||
restorable: restorable.NewImage(i.width, i.height, false),
|
restorable: restorable.NewImage(i.width, i.height, false),
|
||||||
}
|
}
|
||||||
|
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +285,7 @@ func (i *Image) allocate(shareable bool) {
|
|||||||
if n, ok := b.TryAlloc(i.width, i.height); ok {
|
if n, ok := b.TryAlloc(i.width, i.height); ok {
|
||||||
i.backend = b
|
i.backend = b
|
||||||
i.node = n
|
i.node = n
|
||||||
|
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user