restorable: Bug fix: Dispose should be deferred between frames (again)

Updates #913
This commit is contained in:
Hajime Hoshi 2019-08-12 16:27:03 +09:00
parent 4717baa840
commit 628a8d559a

View File

@ -574,6 +574,17 @@ func (i *Image) restore() error {
//
// After disposing, calling the function of the image causes unexpected results.
func (i *Image) Dispose() {
select {
case theImages.deferCh <- struct{}{}:
break
default:
theImages.deferUntilBeginFrame(i.Dispose)
return
}
defer func() {
<-theImages.deferCh
}()
theImages.remove(i)
i.image.Dispose()
i.image = nil