AnalyticalGraphicsInc/cesium — pull request #2155 by kring (2014-09-26 04:20:58+00:00)
Title: Fix a bug in `QuadtreePrimitive.forEachLoadedTile`

When moving the camera around quickly, it is possible to end up with terrain tiles in the replacement queue that haven't had any loading done on them at all. That is, they're in the `START` state instead of the `LOADING` state. Specifically this happens when there are more tiles in the load queue than can be processed in the current frame.

This change makes it so such tiles are no longer returned by `QuadtreePrimitive.forEachLoadedTile` since they are (arguably) not actually loaded. This fixes a few crashes I saw in the wild, mostly when adding and removing layers, because code calling `forEachLoadedTile` wasn't expecting to to see tiles in the `START` state. Originally I was just going to fix the place that made this incorrect assumption, but after I fixed the third such place I realized I'd be better off just avoiding the problem entirely.

Fixes NICTA/NationalMap#358.