From 091e51ae4cedd4ccdc98ef6cb610b35e662cf6d0 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 25 Apr 2021 00:57:06 +0900 Subject: [PATCH] internal/uidriver/glfw: Avoid allocating a new slice --- internal/uidriver/glfw/ui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/uidriver/glfw/ui.go b/internal/uidriver/glfw/ui.go index f51b91d4d..4b95e3093 100644 --- a/internal/uidriver/glfw/ui.go +++ b/internal/uidriver/glfw/ui.go @@ -967,8 +967,8 @@ func (u *UserInterface) loop() error { // Create icon images in a different goroutine (#1478). // In the fullscreen mode, SetIcon fails (#1578). - if imgs := u.getIconImages(); imgs != nil && !u.isFullscreen() { - u.setIconImages(nil) + if imgs := u.getIconImages(); len(imgs) > 0 && !u.isFullscreen() { + u.setIconImages(imgs[:0]) // Convert the icons in the different goroutine, as (*ebiten.Image).At cannot be invoked // from this goroutine. At works only in between BeginFrame and EndFrame.