mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18: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"
|
||||||
"image/color"
|
"image/color"
|
||||||
"math"
|
"math"
|
||||||
"runtime"
|
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/hajimehoshi/ebiten/internal/graphics"
|
"github.com/hajimehoshi/ebiten/internal/graphics"
|
||||||
@ -639,7 +638,6 @@ func (i *Image) Dispose() error {
|
|||||||
}
|
}
|
||||||
i.mipmap.dispose()
|
i.mipmap.dispose()
|
||||||
i.resolvePixelsToSet(false)
|
i.resolvePixelsToSet(false)
|
||||||
runtime.SetFinalizer(i, nil)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -724,7 +722,6 @@ func NewImage(width, height int, filter Filter) (*Image, error) {
|
|||||||
filter: filter,
|
filter: filter,
|
||||||
}
|
}
|
||||||
i.addr = i
|
i.addr = i
|
||||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
|
||||||
return i, nil
|
return i, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,7 +763,6 @@ func NewImageFromImage(source image.Image, filter Filter) (*Image, error) {
|
|||||||
filter: filter,
|
filter: filter,
|
||||||
}
|
}
|
||||||
i.addr = i
|
i.addr = i
|
||||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
|
||||||
|
|
||||||
_ = i.ReplacePixels(graphics.CopyImage(source))
|
_ = i.ReplacePixels(graphics.CopyImage(source))
|
||||||
return i, nil
|
return i, nil
|
||||||
@ -778,7 +774,6 @@ func newImageWithScreenFramebuffer(width, height int) *Image {
|
|||||||
filter: FilterDefault,
|
filter: FilterDefault,
|
||||||
}
|
}
|
||||||
i.addr = i
|
i.addr = i
|
||||||
runtime.SetFinalizer(i, (*Image).Dispose)
|
|
||||||
return i
|
return i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user