Lock Stack's mutex lock like with all other Controls.
This commit is contained in:
parent
a23a0f1088
commit
69bff124a6
9
stack.go
9
stack.go
|
@ -50,6 +50,9 @@ func (s *Stack) SetStretchy(index int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stack) make(window *sysData) error {
|
func (s *Stack) make(window *sysData) error {
|
||||||
|
s.lock.Lock()
|
||||||
|
defer s.lock.Unlock()
|
||||||
|
|
||||||
for i, c := range s.controls {
|
for i, c := range s.controls {
|
||||||
err := c.make(window)
|
err := c.make(window)
|
||||||
if err != nil {
|
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 {
|
func (s *Stack) setRect(x int, y int, width int, height int) error {
|
||||||
|
s.lock.Lock()
|
||||||
|
defer s.lock.Unlock()
|
||||||
|
|
||||||
var stretchywid, stretchyht int
|
var stretchywid, stretchyht int
|
||||||
|
|
||||||
if len(s.controls) == 0 { // do nothing if there's nothing to do
|
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).
|
// 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) {
|
func (s *Stack) preferredSize() (width int, height int, err error) {
|
||||||
|
s.lock.Lock()
|
||||||
|
defer s.lock.Unlock()
|
||||||
|
|
||||||
max := func(a int, b int) int {
|
max := func(a int, b int) int {
|
||||||
if a > b {
|
if a > b {
|
||||||
return a
|
return a
|
||||||
|
|
1
todo.md
1
todo.md
|
@ -25,7 +25,6 @@ so I don't forget:
|
||||||
important things:
|
important things:
|
||||||
- there's no GTK+ error handling whatsoever; we need to figure out how it works
|
- there's no GTK+ error handling whatsoever; we need to figure out how it works
|
||||||
- make sure GTK+ documentation point differences don't matter
|
- make sure GTK+ documentation point differences don't matter
|
||||||
- lock setRect() and preferredSize() in all Controls (including Stack)
|
|
||||||
- button sizes and LineEdit sizes on Windows seem too big; Comboboxes have margins
|
- button sizes and LineEdit sizes on Windows seem too big; Comboboxes have margins
|
||||||
- sometimes the size of the drop-down part of a Combobox becomes 0 or 1 or some other impossibly small value on Windows
|
- sometimes the size of the drop-down part of a Combobox becomes 0 or 1 or some other impossibly small value on Windows
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue