diff --git a/CHANGES.md b/CHANGES.md index 437147741fd1..7e0255b1131d 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,7 @@ Change Log * Fix Firefox WebGL console warnings. [#5912](https://github.com/AnalyticalGraphicsInc/cesium/issues/5912) * Fix parsing Cesium.js in older browsers that do not support all TypedArray types. [#6396](https://github.com/AnalyticalGraphicsInc/cesium/pull/6396) * Fix flicker when adding, removing, or modifying entities. [#3945](https://github.com/AnalyticalGraphicsInc/cesium/issues/3945) +* Fixed crash bug in PolylineCollection when a polyline was updated and removed at the same time. [#6455](https://github.com/AnalyticalGraphicsInc/cesium/pull/6455) * Fixed Imagery Layers Texture Filters Sandcastle example. [#6472](https://github.com/AnalyticalGraphicsInc/cesium/pull/6472). ### 1.44 - 2018-04-02 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index b298aa129217..0d1135678ed0 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -178,3 +178,4 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu * [Stephen Wiseman](https://github.com/srwiseman) * [Gabriel Macario](https://github.com/gabriel-macario) * [Jonathan Puckey](https://github.com/puckey) +* [Mark Erikson](https://github.com/markerikson) diff --git a/Source/Scene/PolylineCollection.js b/Source/Scene/PolylineCollection.js index 936744c6ae0b..3404930bb870 100644 --- a/Source/Scene/PolylineCollection.js +++ b/Source/Scene/PolylineCollection.js @@ -299,6 +299,12 @@ define([ PolylineCollection.prototype.remove = function(polyline) { if (this.contains(polyline)) { this._polylines[polyline._index] = undefined; // Removed later + + var polylineUpdateIndex = this._polylinesToUpdate.indexOf(polyline); + if (polylineUpdateIndex !== -1) { + this._polylinesToUpdate.splice(polylineUpdateIndex, 1); + } + this._polylinesRemoved = true; this._createVertexArray = true; this._createBatchTable = true; diff --git a/Specs/Scene/PolylineCollectionSpec.js b/Specs/Scene/PolylineCollectionSpec.js index ffc2a741e6ea..dfd311ab0030 100644 --- a/Specs/Scene/PolylineCollectionSpec.js +++ b/Specs/Scene/PolylineCollectionSpec.js @@ -329,6 +329,20 @@ defineSuite([ expect(polylines.length).toEqual(0); }); + it('removes a polyline from the updated list when removed', function() { + var firstPolyline = polylines.add(); + var secondPolyline = polylines.add(); + + firstPolyline.width = 4; + secondPolyline.width = 5; + + expect(polylines._polylinesToUpdate.length).toEqual(2); + + polylines.remove(secondPolyline); + + expect(polylines._polylinesToUpdate.length).toEqual(1); + }); + it('can check if it contains a polyline', function() { var polyline = polylines.add();