Commit 821e498
committed
Make StructArray::field() thread-safe
Before this change it was possible for two threads calling `field()`
with the same index at the same time to cause a race on the stored
entry in `boxed_fields_`. I.e. if a second thread goes into the path
that calls `MakeArray` before the first thread stored its own new
array, the second thread would also write to the same shared_ptr and
invalidate the shared_ptr from the first thread, thereby also
invalidating the returned reference.1 parent 934554d commit 821e498
2 files changed
+20
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1076 | 1076 | | |
1077 | 1077 | | |
1078 | 1078 | | |
1079 | | - | |
| 1079 | + | |
1080 | 1080 | | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
1085 | | - | |
1086 | | - | |
1087 | | - | |
1088 | | - | |
1089 | | - | |
1090 | | - | |
| 1081 | + | |
| 1082 | + | |
1091 | 1083 | | |
1092 | | - | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
1093 | 1100 | | |
1094 | 1101 | | |
1095 | 1102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
692 | 692 | | |
693 | 693 | | |
694 | 694 | | |
695 | | - | |
| 695 | + | |
696 | 696 | | |
697 | 697 | | |
698 | 698 | | |
| |||
0 commit comments