From 076617827795aa736025af82fc67b80e82e7092c Mon Sep 17 00:00:00 2001 From: "Brandon McGinty (chatgpt)" Date: Sun, 9 Aug 2026 18:31:03 -0400 Subject: [PATCH] Snapshot connected users under client lock --- client.go | 9 ++++++++- fix.txt | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/client.go b/client.go index fcba652..dddc5dd 100644 --- a/client.go +++ b/client.go @@ -124,7 +124,14 @@ func (b *Barnard) OnConnect(e *gumble.ConnectEvent) { b.UiTree.Rebuild() b.Ui.Refresh() - for _, u := range b.Client.Users { + var users []*gumble.User + b.Client.Do(func() { + users = make([]*gumble.User, 0, len(b.Client.Users)) + for _, u := range b.Client.Users { + users = append(users, u) + } + }) + for _, u := range users { b.UserConfig.UpdateUser(u) b.rememberUserChannel(u) } diff --git a/fix.txt b/fix.txt index 0f17c64..5197116 100644 --- a/fix.txt +++ b/fix.txt @@ -272,7 +272,7 @@ Priority 3: configuration, UI, and binding hardening seconds for the protocol, creating a huge ban duration. Reject negative durations and validate mask/address before sending. -36. Admin, tree, and client code read mutable maps outside Client.Do +[x] 36. Admin, tree, and client code read mutable maps outside Client.Do Files: admin.go, ui_tree.go, client.go UI code ranges Client.Users, Channels, Channel.Users, and Children while network handlers mutate them. This overlaps issue 2 but must be fixed on