Often I randomly create and add particles and don’t entirely understand the memory management best practices.
For instance:
ARCH_OPTIMAL_PARTICLE_SYSTEM *particles = CCParticleSystemQuad::particleWithFile(“particlePlist.plist”);
particles~~>setIsAutoRemoveOnFinish;
particles~~>setPosition(ccp(300,300));
addChild(particles);
results in a crash when in CCScheduler::removeUpdateFromHash element~~>target~~>selectorProtocolRelease(); is called.
If I do not setIsAutoRemoveOnFinish, it’ll crash when the parent node is removed.
I’ve got around this generally by keeping a reference to all created particle systems generated with a new () rather than the static method and ultimately calling
particle~~>unscheduleUpdate;
particle~~>removeFromParentAndCleanup(true);
particle->autorelease();
What is the proper way to instantiate and add a particle system that you’d like to clean up itself after finishing?
Thanks for any help.