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... --- button.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'button.go') diff --git a/button.go b/button.go index 380fdd1..9a5f93c 100644 --- a/button.go +++ b/button.go @@ -29,22 +29,24 @@ func NewButton(text string) (b *Button) { // SetText sets the button's text. func (b *Button) SetText(text string) { + b.lock.Lock() + defer b.lock.Unlock() + if b.created { b.sysData.setText(text) return } - b.lock.Lock() - defer b.lock.Unlock() b.initText = text } // Text returns the button's text. func (b *Button) Text() string { + b.lock.Lock() + defer b.lock.Unlock() + if b.created { return b.sysData.text() } - b.lock.Lock() - defer b.lock.Unlock() return b.initText } -- cgit v1.2.3