-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Make CowData self-inserts safe #34266
Make CowData self-inserts safe #34266
Conversation
Ah I hadn't noticed that your PR'ed it on the |
OK. I'll fix this. What about changes for 4.0, like C++11 atomics? Is |
f59553d
to
2bb7891
Compare
Not yet, but soon. For now it's probably best to PR such changes against |
When inserting an element taking the original from the current data block so that it will be resized, potentially invalidating the reference to the original, a backup is made to base the copy on it instead. Fixes godotengine#31736.
2bb7891
to
d8d5461
Compare
For 3.2 we merged #34618 as a simpler stopgap solution, so we'd probably consider that one too for cherry-picking in 3.1.x. This PR should be reviewed for 4.0. There was a lot of discussion on IRC with @reduz and @hpvb regarding what should be done exactly to solve those issues, which might be worth rediscussing with you. |
IMO I would just close this, the solution is bigger than the problem. As I mentioned in the existing fix, the drawbacks of just copying the value are next to none in real life scenarios. |
When inserting an element taking the original from the current data block so that it will be resized, potentially invalidating the reference to the original, a backup is made to base the copy on it instead.
Fixes #31736.
Other related items (fixed, superseded or plainly related): #16961, #29408, #31159, #31609, #31694.
P. S.: Haven't had time to test this thoroughly.