internal/ui: add a comment

Updates #2796
This commit is contained in:
Hajime Hoshi 2023-09-30 02:53:49 +09:00
parent dce18d7c23
commit 22118ba962

View File

@ -405,6 +405,10 @@ func (u *userInterfaceImpl) getAndResetIconImages() []image.Image {
func (u *userInterfaceImpl) setIconImages(iconImages []image.Image) { func (u *userInterfaceImpl) setIconImages(iconImages []image.Image) {
u.m.Lock() u.m.Lock()
defer u.m.Unlock() defer u.m.Unlock()
// Even if iconImages is nil, always create a slice.
// A 0-size slice and nil are distinguished.
// See the comment in updateIconIfNeeded.
u.iconImages = make([]image.Image, len(iconImages)) u.iconImages = make([]image.Image, len(iconImages))
copy(u.iconImages, iconImages) copy(u.iconImages, iconImages)
} }