`BaseProperty::operator=` causes memory corruption
BaseProperty::operator=
assigns its resMan_
to the other prop's resource manager.
This uses ResourceManager's implicit assignment operator (which we should delete!), copying a vector of pointers from one resMan to another, each believing to be the sole owner of those pointers - this easily causes use-after-free.
BaseProperty& BaseProperty::operator=(const BaseProperty& _cpy) {
resMan_ = _cpy.resMan_;
lock_ = _cpy.lock_;
return *this;
}
Now I'm not sure how to fix this, as it is unclear to me how BaserProperty's operator=
is actually supposed to behave / how existing code might use it - do we want a per-element assignment/copy here? Or more like a pointer assignment?
What should happen when assigning one mesh's property to a prop of another mesh?
My suggestion would be removing operator= from both BaseProperty and ResourceManager, and possibly adding a different method to bulk-assign between two properties of the same size.