shithub: xui

Download patch

ref: e6f07b4a0c59ab3896de3a5ce0b5aefb078c0681
parent: 84a10235c84a8b3c8039d6e5d24c5d172acafd6d
author: Philip Silva <philip.silva@protonmail.com>
date: Sun May 11 10:44:01 EDT 2025

workaround race condition on arm64

--- a/box/box.go
+++ b/box/box.go
@@ -5,6 +5,7 @@
 	"9fans.net/go/draw/memdraw"
 	"image"
 	//"log"
+	"runtime"
 	"sync"
 	"xui/element"
 	"xui/events"
@@ -107,11 +108,16 @@
 	ims := make([]*memdraw.Image, len(b.Elements))
 	wg := sync.WaitGroup{}
 	for i, el := range b.Elements {
-		wg.Add(1)
-		go func(ii int) {
-			ims[ii] = el.Render() //b.boxImg, b.Rs[i].Min)
-			wg.Done()
-		}(i)
+		if runtime.GOARCH != "arm64" {
+			wg.Add(1)
+			go func(ii int) {
+				ims[ii] = el.Render() //b.boxImg, b.Rs[i].Min)
+				wg.Done()
+			}(i)
+		} else {
+			// otherwise every item can end up being the same element
+			ims[i] = el.Render() //b.boxImg, b.Rs[i].Min)
+		}
 	}
 	wg.Wait()
 
--