-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix an incorrect iteration with a workList #6177
base: master
Are you sure you want to change the base?
Fix an incorrect iteration with a workList #6177
Conversation
We cannot modify workList while iterating it, because its type `List` is actually an array container.
Actually it is fine to append items to a This is one major divergence from std containers, which doesn't allow this behavior. In practice we find allowing this makes a lot of code simpler (and potentially faster). Is the code leading to any crashes or bugs? The for loop should be iterating with an integer index instead of using the iterator, if the iterator is just a pointer (and that pointer will change if the list reallocates). |
Yea, I have a same ask here |
It was causing a crash. |
We cannot modify workList while iterating it, because its type
List
is actually an array container.