abraker95 / tanks

2D arcade top-view shooting game
1 stars 0 forks source link

Possible pointer error leading to crashes when Game Closes #58

Closed ghost closed 9 years ago

ghost commented 9 years ago

StdComponent's destructor deletes the data so if you assign it a pointer it will attempt to delete it, resulting in bad things.

ghost commented 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

ghost commented 9 years ago

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.

ghost commented 9 years ago

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.