Commit 76ec84c
authored
While importing `Sync::ConditionVariable` from the sync shard and porting from `Sync::Dll` to `Crystal::PointerLinkedList` I hit an issue with the following snippet:
```crystal
@waiters.each { |waiter| @waiters.delete(waiter) }
```
The `#each` method correctly gets the next pointer before yielding, but incorrectly compares it to `@head` after the block has run; since the block removed the head pointer, then next == head and the iteration stops (oops).
1 parent b8def0b commit 76ec84c
File tree
2 files changed
+37
-16
lines changed- spec/std/crystal
- src/crystal
2 files changed
+37
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
204 | | - | |
205 | | - | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
206 | 211 | | |
207 | | - | |
208 | | - | |
209 | | - | |
| 212 | + | |
210 | 213 | | |
211 | | - | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
212 | 217 | | |
213 | | - | |
214 | | - | |
215 | | - | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
216 | 221 | | |
217 | | - | |
218 | | - | |
| 222 | + | |
219 | 223 | | |
220 | 224 | | |
221 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
222 | 245 | | |
223 | 246 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | | - | |
109 | | - | |
110 | 108 | | |
111 | | - | |
| 109 | + | |
112 | 110 | | |
| 111 | + | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | 114 | | |
117 | 115 | | |
| |||
0 commit comments