Skip to content

Commit

Permalink
Merge pull request fyne-io#4584 from josharian/josh/container-remove-…
Browse files Browse the repository at this point in the history
…race

container: fix data race in container.Remove
  • Loading branch information
Jacalz authored Jan 30, 2024
2 parents 45f01a6 + 2aa2cc6 commit 85644c2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions container.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ func (c *Container) Refresh() {
// This method is not intended to be used inside a loop, to remove all the elements.
// It is much more efficient to call RemoveAll() instead.
func (c *Container) Remove(rem CanvasObject) {
c.lock.Lock()
defer c.lock.Unlock()
if len(c.Objects) == 0 {
return
}

c.lock.Lock()
defer c.lock.Unlock()
for i, o := range c.Objects {
if o != rem {
continue
Expand Down

0 comments on commit 85644c2

Please sign in to comment.