floooh / oryol

A small, portable and extensible C++ 3D coding framework
MIT License
2k stars 200 forks source link

Container classes: prevent item ref invalidation when adding new items #306

Open floooh opened 6 years ago

floooh commented 6 years ago

If an item to be added is a reference to an item in the same container, and the container needs to grow, the item reference will be invalid and a memory corruption might happen. Detect if the container needs to grow, and create a copy of the item before growing.