internal/ui: add a comment

Updates #2796
This commit is contained in:
Hajime Hoshi 2023-09-30 02:53:49 +09:00
parent b24bcb9382
commit 561de574dd

View File

@ -436,6 +436,10 @@ func (u *userInterfaceImpl) getAndResetIconImages() []image.Image {
func (u *userInterfaceImpl) setIconImages(iconImages []image.Image) {
u.m.Lock()
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))
copy(u.iconImages, iconImages)
}