diff options
author | Paul Duffin <paulduffin@google.com> | 2020-06-18 16:31:04 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2020-06-24 14:05:09 +0100 |
commit | ab5467dbd045060c900d314b805ffb708dd92fa6 (patch) | |
tree | 5beeca9a423f0e6e427a19f60298028d7be3d82f /cc/library_sdk_member.go | |
parent | 63a89ef82fe8424c73f3274b8c18d30d2a3268ce (diff) | |
download | soong-ab5467dbd045060c900d314b805ffb708dd92fa6.tar.gz |
Avoid race condition over ExportedSystemIncludeDirs
It is not clear whether this is causing the bug but it is a potential
source of problems and if it does not fix the bug then at least it will
have eliminated this as the culprit.
Bug: 157656545
Test: m nothing
Change-Id: I3abcb9ae501977924d0d514f4d9007ead24fe0a5
Diffstat (limited to 'cc/library_sdk_member.go')
-rw-r--r-- | cc/library_sdk_member.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cc/library_sdk_member.go b/cc/library_sdk_member.go index 441030251..9c543990f 100644 --- a/cc/library_sdk_member.go +++ b/cc/library_sdk_member.go @@ -380,7 +380,11 @@ func (p *nativeLibInfoProperties) PopulateFromVariant(ctx android.SdkMemberConte // Make sure that the include directories are unique. p.ExportedIncludeDirs = android.FirstUniquePaths(exportedIncludeDirs) p.exportedGeneratedIncludeDirs = android.FirstUniquePaths(exportedGeneratedIncludeDirs) - p.ExportedSystemIncludeDirs = android.FirstUniquePaths(ccModule.ExportedSystemIncludeDirs()) + + // Take a copy before filtering out duplicates to avoid changing the slice owned by the + // ccModule. + dirs := append(android.Paths(nil), ccModule.ExportedSystemIncludeDirs()...) + p.ExportedSystemIncludeDirs = android.FirstUniquePaths(dirs) p.ExportedFlags = ccModule.ExportedFlags() if ccModule.linker != nil { |