From 7b32d7a206eff408f17a57bc1177ef2b0695dbeb Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 17 Aug 2016 22:10:29 +0900 Subject: [PATCH] graphics: Bug fix: Pixels should be copied to store it as a command --- internal/graphics/image.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/graphics/image.go b/internal/graphics/image.go index 5b9426c6f..0ef36bd27 100644 --- a/internal/graphics/image.go +++ b/internal/graphics/image.go @@ -116,9 +116,11 @@ func (i *Image) Pixels(context *opengl.Context) ([]uint8, error) { } func (i *Image) ReplacePixels(p []uint8) error { + pixels := make([]uint8, len(p)) + copy(pixels, p) c := &replacePixelsCommand{ dst: i, - pixels: p, + pixels: pixels, } theCommandQueue.Enqueue(c) return nil