calling removeSelf() on stage object

Kinda looks like doing a removeSelf() on the current stage generates a SIGSEGV on android, but indicates no problem in the simulator (Windows 2016.2830). Possibly belongs in the category of “well, don’t do that”, but I really hate to see something die horribly on device that works fine in the simulator because it stimulates a crisis of faith. :slight_smile:

Can someone give an official judgement on whether removeSelf() is supposed to work on the current stage?

I can generate a minimal working example if it’s necessary, but seemed easier to start with defining what the expected behavior is.

Why not just stick with “display.remove(object)”.?

–SonicX278

You should not be removing the main stage. Of course we need to harden the simulator to not crash when it happens. There is no real reason to remove the main stage. If you want to remove all your display objects in one fell swoop, create your own group and add your objects to that group.

Rob

Yeah, the point was never that there was any mystery about how to avoid the crash, but I failed miserably to express that.

> we need to harden the simulator to not crash when it happens.

Actually, I would have kept calm and carried on if the simulator had crashed. It’s crashed on me before and I find/fix/workaround no problem. Unfortunately, the code worked fine in the simulator and only crashed on a device. That makes me worry about whether this is a really unlucky case of that, or a common enough occurrence that my dream of doing most testing with the simulator is misplaced.

I’m not sure how you could get into a situation where you prevented it in the sim but not on the device. But still we need to harden this.

Rob

Why not just stick with “display.remove(object)”.?

–SonicX278

You should not be removing the main stage. Of course we need to harden the simulator to not crash when it happens. There is no real reason to remove the main stage. If you want to remove all your display objects in one fell swoop, create your own group and add your objects to that group.

Rob

Yeah, the point was never that there was any mystery about how to avoid the crash, but I failed miserably to express that.

> we need to harden the simulator to not crash when it happens.

Actually, I would have kept calm and carried on if the simulator had crashed. It’s crashed on me before and I find/fix/workaround no problem. Unfortunately, the code worked fine in the simulator and only crashed on a device. That makes me worry about whether this is a really unlucky case of that, or a common enough occurrence that my dream of doing most testing with the simulator is misplaced.

I’m not sure how you could get into a situation where you prevented it in the sim but not on the device. But still we need to harden this.

Rob