sdslabs / Rootex

An advanced C++ 3D game engine powering an in-production game yet to be announced
https://rootex.readthedocs.io/
Other
215 stars 34 forks source link

Fix vector erase bug #595

Closed Bashar-Ahmed closed 1 year ago

Bashar-Ahmed commented 2 years ago

Fixes #593

twaritwaikar commented 2 years ago

onRemove() doesn't seem to be the proper place to make this change. Calling a destructor manually should be done at the site where a placement new operator was used.

You should be able to call the destructor directly instead of relaying it through Component::onRemove(). The onRemove() function is executed when the component is detached from an entity. It has nothing to do with resource de-allocation.