Particle crash if setAutoRemoveOnFinish(true) in cocos2d-x v2.0.1

I am trying to update cocos2d-x from 1.0.1 to 2.0.1 in our game, then I found a weird problem about particle, I don’t know if it is a bug or just new way to use it:

I have code below in the ccTouchBegan() of the scene:

CCParticleSystem* par = CCParticleSystemQuad::create("particle.plist"); par->setPosition(touchLocation); par->setAutoRemoveOnFinish(true); addChild(par);

It works properly in 1.0.1 and auto remove itself when finished, but in 2.0.1, I got crash! It’s weird because it works in iOS but crash in windows.
It crashs when the particle finishes in CCParticleSystem.\ If\ I\ set\ AutoRemoveOnFinish\ as\ false,\ then\ no\ crash.
Finally\ I\ add\ par->retain();\ then\ it’s\ OK\ on\ all\ the\ platform,\ Is\ it\ a\ bug?\ Or\ we\ need\ to\ use\ it\ that\ after\ all?
Now\ I\ hesitate\ that\ if\ we\ should\ update\ our\ code\ to\ cocos2d-x\ 2.0.1,\ I\ need\ to\ balance\ with\ the\ new\ features\ and\ hidden\ danger.
Any\ suggestion?\ Big\ help

Oh, sorry.
We will checkout it out.

I think v2.0.1 is stable enough to use, and it doesn’t have serious bug.

Hi, it is a bug(#1371) of double free in CCScheduler::removeUpdateFromHash. And it has been fixed at https://github.com/cocos2d/cocos2d-x/pull/1077/files.
Thanks for your feedback. :slight_smile:

It works properly now, thank you for updating.~

James Chen wrote:

Hi, it is a bug(#1371) of double free in CCScheduler::removeUpdateFromHash. And it has been fixed at https://github.com/cocos2d/cocos2d-x/pull/1077/files.
Thanks for your feedback. :slight_smile:

I have been able to reproduce this bug on cocos2d-x 3.14.
Repro step:

  • Use setAutoRemoveOnFinish(true) on a ParticleEmiiter (it was a Quad for me).
  • Crash.