Unverified Commit ca392970 authored by Cristian Maglie's avatar Cristian Maglie Committed by GitHub

Fix concurrency problem in Board.buildConfigOptionsStructures (fix some rare...

Fix concurrency problem in Board.buildConfigOptionsStructures (fix some rare crash of the CLI/Arduino IDE) (#1972)
parent 79e64842
...@@ -18,6 +18,7 @@ package cores ...@@ -18,6 +18,7 @@ package cores
import ( import (
"fmt" "fmt"
"strings" "strings"
"sync"
"github.com/arduino/go-properties-orderedmap" "github.com/arduino/go-properties-orderedmap"
) )
...@@ -27,6 +28,7 @@ type Board struct { ...@@ -27,6 +28,7 @@ type Board struct {
BoardID string BoardID string
Properties *properties.Map `json:"-"` Properties *properties.Map `json:"-"`
PlatformRelease *PlatformRelease `json:"-"` PlatformRelease *PlatformRelease `json:"-"`
configOptionsMux sync.Mutex
configOptions *properties.Map configOptions *properties.Map
configOptionValues map[string]*properties.Map configOptionValues map[string]*properties.Map
configOptionProperties map[string]*properties.Map configOptionProperties map[string]*properties.Map
...@@ -69,6 +71,8 @@ func (b *Board) String() string { ...@@ -69,6 +71,8 @@ func (b *Board) String() string {
} }
func (b *Board) buildConfigOptionsStructures() { func (b *Board) buildConfigOptionsStructures() {
b.configOptionsMux.Lock()
defer b.configOptionsMux.Unlock()
if b.configOptions != nil { if b.configOptions != nil {
return return
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment