Skip to content

Commit

Permalink
add missed locking in Check
Browse files Browse the repository at this point in the history
  • Loading branch information
dweymouth committed Feb 1, 2024
1 parent 3ad2fa0 commit 0f9f269
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions widget/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,18 @@ func (c *Check) Bind(data binding.Bool) {

// SetChecked sets the the checked state and refreshes widget
func (c *Check) SetChecked(checked bool) {
c.propertyLock.Lock()
if checked == c.Checked {
c.propertyLock.Unlock()
return
}

c.Checked = checked
onChanged := c.OnChanged
c.propertyLock.Unlock()

if c.OnChanged != nil {
c.OnChanged(c.Checked)
if onChanged != nil {
onChanged(checked)
}

c.Refresh()
Expand Down Expand Up @@ -212,7 +216,9 @@ func (c *Check) TypedKey(key *fyne.KeyEvent) {}
//
// Since: 2.4
func (c *Check) SetText(text string) {
c.propertyLock.Lock()
c.Text = text
c.propertyLock.Unlock()
c.Refresh()
}

Expand Down

0 comments on commit 0f9f269

Please sign in to comment.