We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.
Move the non-reference counted stuff out of Object
Move the non-reference counted stuff out of Object
Refactor #3519 [Closed]
- Target version changed from 88 to 34
- Description updated (diff)
- Status changed from New to Closed
- Target version changed from 34 to 3.0-beta2
We've fixed this by the new cocos2d::Ref
My Email:¶
Indeed, I agree to move `autorelease` stuff outside of Object.
Now, in our Object class, there are some other variables and methods not refer to reference counting.
We should only keep (1) , move all others out of our Object.
Problem:¶
There will not autorelease() method for all objects. So the old code will not be able to work.
My Idea:¶
Since autorelease is just a method that adding an object to autorelease pool.
So probably, we could define a macro like:
Therefore, the Sprite::create will be :
Yep, in fact, we don’t encourage developer to use `autorelease` stuff in their game codes. It’s hard to detect where to cause crash since autorelease delay the release operation.
We encourage them to write codes like: