From a06d4d696667cb7d05a1f1606cf8856f56e0d54d Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 16 Oct 2018 11:04:09 -0400 Subject: [PATCH 1/4] Don't add polyline to update list twice --- Source/Scene/PolylineCollection.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Scene/PolylineCollection.js b/Source/Scene/PolylineCollection.js index 9600055b9701..1ba3516155a6 100644 --- a/Source/Scene/PolylineCollection.js +++ b/Source/Scene/PolylineCollection.js @@ -1128,7 +1128,9 @@ define([ PolylineCollection.prototype._updatePolyline = function(polyline, propertyChanged) { this._polylinesUpdated = true; - this._polylinesToUpdate.push(polyline); + if (this._polylinesToUpdate.indexOf(polyline) === -1) { + this._polylinesToUpdate.push(polyline); + } ++this._propertiesChanged[propertyChanged]; }; From 201359f1c4e0772069cdecba8308ecd20181b715 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 16 Oct 2018 11:31:48 -0400 Subject: [PATCH 2/4] better fix --- Source/Scene/PolylineCollection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Scene/PolylineCollection.js b/Source/Scene/PolylineCollection.js index 1ba3516155a6..821c6b160043 100644 --- a/Source/Scene/PolylineCollection.js +++ b/Source/Scene/PolylineCollection.js @@ -1128,7 +1128,7 @@ define([ PolylineCollection.prototype._updatePolyline = function(polyline, propertyChanged) { this._polylinesUpdated = true; - if (this._polylinesToUpdate.indexOf(polyline) === -1) { + if (!polyline._dirty) { this._polylinesToUpdate.push(polyline); } ++this._propertiesChanged[propertyChanged]; From 4d0d72441e5052e109d36ccdfc4409b42afd56b6 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 16 Oct 2018 14:04:08 -0400 Subject: [PATCH 3/4] CHANGES.md --- CHANGES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES.md b/CHANGES.md index 769becb247ec..1c8d5a02175e 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -10,6 +10,7 @@ Change Log ##### Fixes :wrench: * Fixed an issue where `pickPosition` would return incorrect results when called after `sampleHeight` or `clampToHeight`. [#7113](https://github.com/AnalyticalGraphicsInc/cesium/pull/7113) +* Fixed crash when updating polyline attributes twice in one frame [#7155](https://github.com/AnalyticalGraphicsInc/cesium/pull/7155) * Fixed a crash when using `BingMapsGeocoderService` [#7143](https://github.com/AnalyticalGraphicsInc/cesium/issues/7143) ### 1.50 - 2018-10-01 From 13448fcc4291eef0f072793adf8ce13527a13d65 Mon Sep 17 00:00:00 2001 From: hpinkos Date: Tue, 16 Oct 2018 16:58:19 -0400 Subject: [PATCH 4/4] unit test --- Specs/Scene/PolylineCollectionSpec.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/Specs/Scene/PolylineCollectionSpec.js b/Specs/Scene/PolylineCollectionSpec.js index 195fef56704c..c722f9a8c71f 100644 --- a/Specs/Scene/PolylineCollectionSpec.js +++ b/Specs/Scene/PolylineCollectionSpec.js @@ -343,6 +343,21 @@ defineSuite([ expect(polylines._polylinesToUpdate.length).toEqual(1); }); + it('only adds polyline to the update list once', function() { + var firstPolyline = polylines.add(); + var secondPolyline = polylines.add(); + + firstPolyline.width = 4; + secondPolyline.width = 5; + secondPolyline.width = 7; + + 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();