fix objects copy

This commit is contained in:
Cyrille Nofficial 2022-09-01 16:30:07 +02:00
parent b12e2a4739
commit 424b697612

View File

@ -201,7 +201,9 @@ func (c *Controller) Objects() []*events.Object {
c.muObjects.RLock() c.muObjects.RLock()
defer c.muObjects.RUnlock() defer c.muObjects.RUnlock()
res := make([]*events.Object, 0, len(c.objects)) res := make([]*events.Object, 0, len(c.objects))
copy(res, c.objects) for _, o := range c.objects {
res = append(res, o)
}
zap.S().Debugf("copy object from %v to %v", c.objects, res) zap.S().Debugf("copy object from %v to %v", c.objects, res)
return res return res
} }