mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
shareable: Bug fix: Call SetFinalizer whenever a new image is created
Fixes #637
This commit is contained in:
parent
934251ab83
commit
91dbb73799
@ -273,6 +273,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
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -280,6 +281,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