From 24342eb05d70af48d609a224351237eb1f3d41d2 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 18 Mar 2014 11:50:56 -0400 Subject: 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... --- checkbox.go | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'checkbox.go') 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 } -- cgit v1.2.3