Skip to content

Commit ca39297

Browse files
authored
Fix concurrency problem in Board.buildConfigOptionsStructures (fix some rare crash of the CLI/Arduino IDE) (#1972)
1 parent 79e6484 commit ca39297

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Diff for: arduino/cores/board.go

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package cores
1818
import (
1919
"fmt"
2020
"strings"
21+
"sync"
2122

2223
"github.com/arduino/go-properties-orderedmap"
2324
)
@@ -27,6 +28,7 @@ type Board struct {
2728
BoardID string
2829
Properties *properties.Map `json:"-"`
2930
PlatformRelease *PlatformRelease `json:"-"`
31+
configOptionsMux sync.Mutex
3032
configOptions *properties.Map
3133
configOptionValues map[string]*properties.Map
3234
configOptionProperties map[string]*properties.Map
@@ -69,6 +71,8 @@ func (b *Board) String() string {
6971
}
7072

7173
func (b *Board) buildConfigOptionsStructures() {
74+
b.configOptionsMux.Lock()
75+
defer b.configOptionsMux.Unlock()
7276
if b.configOptions != nil {
7377
return
7478
}

0 commit comments

Comments
 (0)