Clone Group.Data and Client.Data.
This avoids a race condition. Thanks to git-lul.
This commit is contained in:
+2
-1
@@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"io/fs"
|
||||
"log"
|
||||
"maps"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
@@ -133,7 +134,7 @@ func (g *Group) SetLocked(locked bool, message string) {
|
||||
func (g *Group) Data() map[string]interface{} {
|
||||
g.mu.Lock()
|
||||
defer g.mu.Unlock()
|
||||
return g.data
|
||||
return maps.Clone(g.data)
|
||||
}
|
||||
|
||||
func (g *Group) UpdateData(d map[string]interface{}) {
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
"maps"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
@@ -101,7 +102,7 @@ func (c *webClient) Permissions() []string {
|
||||
}
|
||||
|
||||
func (c *webClient) Data() map[string]interface{} {
|
||||
return c.data
|
||||
return maps.Clone(c.data)
|
||||
}
|
||||
|
||||
func (c *webClient) SetPermissions(perms []string) {
|
||||
|
||||
Reference in New Issue
Block a user