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