diff --git a/CHANGES.md b/CHANGES.md index d7220293c779..31b15f03dd6b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ Change Log * Improved `Plane` entities so they are better aligned with the globe surface [#6887](https://github.com/AnalyticalGraphicsInc/cesium/pull/6887) * Fixed crash when rendering translucent objects when all shadow maps in the scene set `fromLightSource` to false. [#6883](https://github.com/AnalyticalGraphicsInc/cesium/pull/6883) * Fixed night shading in 2D and Columbus view. [#4122](https://github.com/AnalyticalGraphicsInc/cesium/issues/4122) +* Fixed crash that happened when calling `scene.pick` after setting a new terrain provider [#6918](https://github.com/AnalyticalGraphicsInc/cesium/pull/6918) ### 1.48 - 2018-08-01 diff --git a/Source/Scene/QuadtreePrimitive.js b/Source/Scene/QuadtreePrimitive.js index 9ed7a6ce0aeb..475051cb1c70 100644 --- a/Source/Scene/QuadtreePrimitive.js +++ b/Source/Scene/QuadtreePrimitive.js @@ -300,6 +300,11 @@ define([ return; } + if (this._tilesInvalidated) { + invalidateAllTiles(this); + this._tilesInvalidated = false; + } + // Gets commands for any texture re-projections this._tileProvider.initialize(frameState); @@ -376,16 +381,10 @@ define([ return; } - if (this._tilesInvalidated) { - invalidateAllTiles(this); - } - // Load/create resources for terrain and imagery. Prepare texture re-projections for the next frame. processTileLoadQueue(this, frameState); updateHeights(this, frameState); updateTileLoadProgress(this, frameState); - - this._tilesInvalidated = false; }; /** diff --git a/Specs/Scene/GlobeSurfaceTileProviderSpec.js b/Specs/Scene/GlobeSurfaceTileProviderSpec.js index c287014611dd..00919c6f7c80 100644 --- a/Specs/Scene/GlobeSurfaceTileProviderSpec.js +++ b/Specs/Scene/GlobeSurfaceTileProviderSpec.js @@ -674,12 +674,14 @@ defineSuite([ var surface = scene.globe._surface; var replacementQueue = surface._tileReplacementQueue; expect(replacementQueue.count).toBeGreaterThan(0); + var oldTile = replacementQueue.head; surface.tileProvider.terrainProvider = new EllipsoidTerrainProvider(); scene.renderForSpecs(); - expect(replacementQueue.count).toBe(0); + expect(replacementQueue.count).toBeGreaterThan(0); + expect(replacementQueue.head).not.toBe(oldTile); }); });