CCNode/CCSprite NOT null. But cannot access properties.

CCNode/CCSprite NOT null. But cannot access properties.
0.0 0


I’m adding and removing a small CCSprite over the course of the game. It works fine for the first 3 to 4 times. But after a that, it crashes. This happens when I deploy in android device. Here’s some code…

CCSprite sp= CCSprite::create("ping.png"); 
pingList.push_back(sp); // pingList is a vector of CCSprites

//somewhere else in the code, I do,

if(!=NULL) //Passes this condition and goes inside
    CCLog("ping tag %d",>getTag()); //But crashes here

Any idea what could be going wrong? Or is there any way to check during runtime if actually holds a valid CCSprite/CCNode (as opposed to some random junk value)? I can provide more code/detail if needed.

In logcat I just get this,
Fatal signal 11 (SIGSEGV) at 0x00000000 (code=1), thread 12410 (Thread-3572)


I think you should use retain/release to control reference count. This is why we offer CCArray, which will invoke retain when push back an element, and will release when it is popped.

So i suggest you using Array instead of std::vector.


Okay. I’m gonna try this and see how it goes. thanks. :slight_smile: