From 16b3a5c296ba546af5fd842c213ba840b09b695b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sat, 16 Nov 2019 16:38:55 +0900 Subject: [PATCH] buffered: Bug fix: Needed to copy pixels when buffering Updates #983 --- internal/buffered/image.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/internal/buffered/image.go b/internal/buffered/image.go index 6414a0a21..7dd9cb956 100644 --- a/internal/buffered/image.go +++ b/internal/buffered/image.go @@ -205,7 +205,9 @@ func (i *Image) ReplacePixels(pix []byte) { delayedCommandsM.Lock() if needsToDelayCommands { delayedCommands = append(delayedCommands, func() { - i.img.ReplacePixels(pix) + copied := make([]byte, len(pix)) + copy(copied, pix) + i.img.ReplacePixels(copied) }) delayedCommandsM.Unlock() return