@Greenhouse wrote:
What is the common pattern to derive from Ref without leaks?
Is the following snippet safe?
class Derived : public cocos2d::Ref { public: Derived () : x(0), y(0), z(nullptr) {} size_t x; size_t y; cocos2d::Sprite* z; };
Should I add destructor to
Derived
as well:~Derived () { if (this->getReferenceCount() > 0) this->release(); }
Posts: 5
Participants: 2