From f30b274c1fd0cc1088b5eb49016da771bee013eb Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 3 May 2017 03:13:22 +0900 Subject: [PATCH] graphics: Bug fix: Keep a restorable.Image before disposing --- image.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/image.go b/image.go index 446e2ac40..9b9a659d0 100644 --- a/image.go +++ b/image.go @@ -58,12 +58,13 @@ func (i *images) add(img *restorable.Image) *Image { } func (i *images) remove(img *Image) { + r := img.restorable if err := img.Dispose(); err != nil { panic(err) } i.m.Lock() defer i.m.Unlock() - delete(i.images, img.restorable) + delete(i.images, r) runtime.SetFinalizer(img, nil) }