mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Remove SetFinalizer at Image
Package shareable should take care of this. Finalizers are called at arbitrary timing in a different goroutine and might cause tough problems. This might be related to #821.
This commit is contained in:
parent
f19d7a29b8
commit
5195161253
5
image.go
5
image.go
@ -19,7 +19,6 @@ import (
|
||||
"image"
|
||||
"image/color"
|
||||
"math"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
||||
@ -639,7 +638,6 @@ func (i *Image) Dispose() error {
|
||||
}
|
||||
i.mipmap.dispose()
|
||||
i.resolvePixelsToSet(false)
|
||||
runtime.SetFinalizer(i, nil)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -724,7 +722,6 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
||||
filter: filter,
|
||||
}
|
||||
i.addr = i
|
||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||
return i, nil
|
||||
}
|
||||
|
||||
@ -766,7 +763,6 @@ func NewImageFromImage(source image.Image, filter Filter) (*Image, error) {
|
||||
filter: filter,
|
||||
}
|
||||
i.addr = i
|
||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||
|
||||
_ = i.ReplacePixels(graphics.CopyImage(source))
|
||||
return i, nil
|
||||
@ -778,7 +774,6 @@ func newImageWithScreenFramebuffer(width, height int) *Image {
|
||||
filter: FilterDefault,
|
||||
}
|
||||
i.addr = i
|
||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
||||
return i
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user