HaxeFlixel/flixel — pull request #1219 by JoeCreates (2014-07-10 23:12:49+00:00)
Title: Remove race condition when opening/closing substates in same update

This took a while to figure out the issue, seeing as it only happened one in sixty or so tries.

Basically, if you have a state with `persistentUpdate = true`, it's possible that the parent state will try to open a new substate when a substate is already open, which is fine. However, the substate may also have a way of being closed. If the substate tries to close on the same frame as the parent state tries to open a new substate, there is a race condition which might result in the new substate not opening.