Closed ghost closed 9 years ago
You should "move" data into the stdComponent, that means data won't be a pointer anymore. http://en.cppreference.com/w/cpp/utility/move
Good idea
On Wed, Dec 24, 2014 at 3:16 AM, Sherushe notifications@github.com wrote:
You should "move" data into the stdComponent, that means data won't be a pointer anymore. http://en.cppreference.com/w/cpp/utility/move
— Reply to this email directly or view it on GitHub https://github.com/Sherushe/tanks/issues/58#issuecomment-68035492.
Unfortunately, I tried move and it's not what I exactly needed. I resolved the issue by making a setter function that checks if the variable points to something to decide if it needs to be deleted or not.
StdComponent's destructor deletes the data so if you assign it a pointer it will attempt to delete it, resulting in bad things.