Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Source/Scene/CentralBodySurface.js
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ define([
if (imageryLayer.getImageryProvider().isReady()) {
// Remove the placeholder and add the actual skeletons (if any)
// at the same position. Then continue the loop at the same index.
imagery.releaseReference();
tileImagery.freeResources();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this fix related to the bug? Or did you just spot it while you happened to be in here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just spotted it when I copied the code from here down to below. It's probably not a bug, either, but it's better this way.

tileImageryCollection.splice(i, 1);
imageryLayer._createTileImagerySkeletons(tile, terrainProvider, i);
--i;
Expand Down Expand Up @@ -704,6 +704,15 @@ define([
parent = parent.parent;
}

// If there's no valid parent, remove this TileImagery from the tile.
if (typeof parent === 'undefined') {
tileImagery.freeResources();
tileImageryCollection.splice(i, 1);
--i;
len = tileImageryCollection.length;
continue;
}

// use that parent imagery instead, storing the original imagery
// in originalImagery to keep it alive
tileImagery.originalImagery = imagery;
Expand Down
26 changes: 24 additions & 2 deletions Specs/Scene/CentralBodySurfaceSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ defineSuite([
'Scene/ImageryLayerCollection',
'Scene/OrthographicFrustum',
'Scene/SceneMode',
'Scene/SingleTileImageryProvider'
'Scene/SingleTileImageryProvider',
'Scene/WebMapServiceImageryProvider'
], function(
CentralBodySurface,
createContext,
Expand All @@ -36,7 +37,8 @@ defineSuite([
ImageryLayerCollection,
OrthographicFrustum,
SceneMode,
SingleTileImageryProvider) {
SingleTileImageryProvider,
WebMapServiceImageryProvider) {
"use strict";
/*global jasmine,describe,xdescribe,it,xit,expect,beforeEach,afterEach,beforeAll,afterAll,spyOn,runs,waits,waitsFor*/

Expand Down Expand Up @@ -346,5 +348,25 @@ defineSuite([
expect(render(context, frameState, cb)).toBeGreaterThan(0);
});
});

it('renders even if imagery root tiles fail to load', function() {
var layerCollection = cb.getImageryLayers();
layerCollection.removeAll();

var providerWithInvalidRootTiles = new WebMapServiceImageryProvider({
url : '/invalid',
layers : 'invalid'
});

layerCollection.addImageryProvider(providerWithInvalidRootTiles);

frameState.camera.viewExtent(new Extent(0.0001, 0.0001, 0.0025, 0.0025), Ellipsoid.WGS84);

updateUntilDone(cb);

runs(function() {
expect(render(context, frameState, cb)).toBeGreaterThan(0);
});
});
});
});