summaryrefslogtreecommitdiff
path: root/checkbox.go
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-03-18 11:50:56 -0400
committerPietro Gagliardi <[email protected]>2014-03-18 11:50:56 -0400
commit24342eb05d70af48d609a224351237eb1f3d41d2 (patch)
treea76faba6d73910fa1f982e58a0f3696c5c702ff8 /checkbox.go
parentb95d581e86ee57de7c163efa5eb0fb165d0a1032 (diff)
Restored the locks everywhere except on resizing calculations. I'll run under the assumption that uitask cannot process any requests while a resize occurs, which means preferredSize() and Stack/Grid.setRect() are inherently safe... let's hope I'm right...
Diffstat (limited to 'checkbox.go')
-rw-r--r--checkbox.go15
1 files changed, 9 insertions, 6 deletions
diff --git a/checkbox.go b/checkbox.go
index c5f0217..fe46023 100644
--- a/checkbox.go
+++ b/checkbox.go
@@ -27,32 +27,35 @@ func NewCheckbox(text string) (c *Checkbox) {
// SetText sets the checkbox's text.
func (c *Checkbox) SetText(text string) {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
if c.created {
c.sysData.setText(text)
return
}
- c.lock.Lock()
- defer c.lock.Unlock()
c.initText = text
}
// Text returns the checkbox's text.
func (c *Checkbox) Text() string {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
if c.created {
return c.sysData.text()
}
- c.lock.Lock()
- defer c.lock.Unlock()
return c.initText
}
// Checked() returns whether or not the checkbox has been checked.
func (c *Checkbox) Checked() bool {
+ c.lock.Lock()
+ defer c.lock.Unlock()
+
if c.created {
return c.sysData.isChecked()
}
- c.lock.Lock()
- defer c.lock.Unlock()
return false
}