matcha icon indicating copy to clipboard operation
matcha copied to clipboard

BUG: Race condition in Image ID allocation

Open andrinoff opened this issue 7 months ago • 1 comments

Describe the bug

In view/html.go:281, var nextImageID uint32 = 1000 is incremented by allocImageID() using nextImageID++. If multiple goroutines request an ID simultaneously, this will cause a race condition and duplicate IDs.

To reproduce

Run the app with -race while rendering multiple terminal images concurrently.

Expected behavior

Use atomic.Uint32 or atomic.AddUint32(&nextImageID, 1) for thread-safe increments.

andrinoff avatar Apr 20 '26 19:04 andrinoff

Already handled, close it.

mavonx avatar May 10 '26 13:05 mavonx