diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-25 19:16:26 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-25 19:16:26 -0500 |
| commit | 69bff124a605996dc9a9b34d61bd101eb413d1c6 (patch) | |
| tree | b2ebe5067b65abec280342f1a9eebd31b13e540d /stack.go | |
| parent | a23a0f10885d79e615b2c40b794d4e4fa99401ce (diff) | |
Lock Stack's mutex lock like with all other Controls.
Diffstat (limited to 'stack.go')
| -rw-r--r-- | stack.go | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -50,6 +50,9 @@ func (s *Stack) SetStretchy(index int) { } func (s *Stack) make(window *sysData) error { + s.lock.Lock() + defer s.lock.Unlock() + for i, c := range s.controls { err := c.make(window) if err != nil { @@ -61,6 +64,9 @@ func (s *Stack) make(window *sysData) error { } func (s *Stack) setRect(x int, y int, width int, height int) error { + s.lock.Lock() + defer s.lock.Unlock() + var stretchywid, stretchyht int if len(s.controls) == 0 { // do nothing if there's nothing to do @@ -121,6 +127,9 @@ func (s *Stack) setRect(x int, y int, width int, height int) error { // The preferred size of a Stack is the sum of the preferred sizes of non-stretchy controls + (the number of stretchy controls * the largest preferred size among all stretchy controls). func (s *Stack) preferredSize() (width int, height int, err error) { + s.lock.Lock() + defer s.lock.Unlock() + max := func(a int, b int) int { if a > b { return a |
