Hi
@atilim, I have a reproducible crash when testing my app in the player running on a real iOS device (iPad). A screendump of the stack trace is attached.
I say it is reproducible, which it is, but it occurs mid-way through a sequence of automated tests. It's about a couple of minutes into the tests so I can't really give you a short test case to reproduce it where you are. Is there anything that you can glean from the stack trace that might allow me to narrow down the problem and give you more info.
I think the issue is something to do with using a Timer to remove an object from the stage after a scene manager transition has completed. The Timer was initiated by the outgoing scene and the completion function holds back references to objects that are/were in that scene.
best regards
Comments
This is working fine and I use it in several places. The test runner uses it and the app uses it for chaining tweens together. So far it has been very reliable.
The current problem may be related but I can prevent it by commenting out a particular section of code that is nothing to do with coroutines.
Basically, I have a new class called BhSceneLayer, which is a Sprite container that I can animate in parallel to the standard SceneManager scenes. This is so I can have several layers moving in different directions (not just the direction imposed by the Scene Manager).
When the BhSceneLayer detects that a scene change is starting, it removes itself from its current parent and places itself in the stage. Then it start to monitor ENTER_FRAME events so it can animate in much the same way as the SceneManager does. It starts a Timer for the duration of the animation so that it can later put itself back into its original parent when the animation is complete.
At this point I'm assuming that the original parent will be removed from the stage by the SceneManager and everything will get tidied up.
If I comment out the bits where the BhSceneLayer is moved to the stage and back again, then the problem goes away. Needless to say, the process works 99% of the time but occasionally (as reproducibly) it fails in the same place.
best regards
So that, does crashing occur immediately or vanish?
best regards
However, if I use the following as part of the ENTER_FRAME handler:
So the problem is most likely to do with adding a Sprite back into another Sprite that has been removed from the stage and is only kept alive by that self.oldParent link.
This is not quite a fix for me yet as I can't really use the .isHiding check. I will do some more experimenting to see if I can bypass the issue with what I now know.
best regards
That fixed some weird behavior when events and coroutines together.
I'll send you a development version so that can you check if crashing is solved or not?
thank you.
I can stop the crash occurring by adding a 100ms delay to the test. Manually, trying to force the problem doesn't seem to cause it so I'm thinking is is some weird race condition with frame handlers and coroutines.
I'm relatively happy (even though it's taken me a whole day to come to this conclusion) that I can live with the state of the system as it is, so you needn't pull your hair out over it.
It might still be worth sending me the development version so I can check to see if your fix addresses the original problem (and hopefully, the coroutine timer problem I mentioned in the other thread too).
thanks for your help
best regards