diff --git a/CHANGES.md b/CHANGES.md index ecc231f785d..12846152e92 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -22,6 +22,7 @@ - Fix globe materials when lighting is false. Slope/Aspect material no longer rely on turning on lighting or shadows. [#11563](https://github.com/CesiumGS/cesium/issues/11563) - Fixed a bug where `GregorianDate` constructor would not validate the input parameters for valid date. [#10075](https://github.com/CesiumGS/cesium/pull/10075) - Fixed improper scaling of ellipsoid inner radii in 3D mode. [#11656](https://github.com/CesiumGS/cesium/issues/11656) and [#10245](https://github.com/CesiumGS/cesium/issues/10245) +- Fixed an issue where `DataSource` objects incorrectly shared a single `PolylineCollection` in the `PolylineGeometryUpdater`. Updated `PolylineGeometryUpdater` to create a distinct `PolylineCollection` instance per `DataSource`. This resolves the crashes reported under [#7758](https://github.com/CesiumGS/cesium/issues/7758) and [#9154](https://github.com/CesiumGS/cesium/issues/9154). #### @cesium/widgets diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index 0f86551f31e..db802c9e918 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -371,6 +371,7 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to contribute to Cesiu - [hongfaqiu](https://github.com/hongfaqiu) - [KOBAYASHI Ittoku](https://github.com/kittoku) - [王康](https://github.com/yieryi) +- [rropp5](https://github.com/rropp5) - [孙永政](https://github.com/syzdev) - [Subhajit Saha](https://github.com/subhajits) - [Jared Webber](https://github.com/jaredwebber) diff --git a/packages/engine/Source/DataSources/PolylineGeometryUpdater.js b/packages/engine/Source/DataSources/PolylineGeometryUpdater.js index 6ad349c9d86..44798c2cc26 100644 --- a/packages/engine/Source/DataSources/PolylineGeometryUpdater.js +++ b/packages/engine/Source/DataSources/PolylineGeometryUpdater.js @@ -661,12 +661,13 @@ function getLine(dynamicGeometryUpdater) { return dynamicGeometryUpdater._line; } - const sceneId = dynamicGeometryUpdater._geometryUpdater._scene.id; - let polylineCollection = polylineCollections[sceneId]; const primitives = dynamicGeometryUpdater._primitives; + const polylineCollectionId = + dynamicGeometryUpdater._geometryUpdater._scene.id + primitives._guid; + let polylineCollection = polylineCollections[polylineCollectionId]; if (!defined(polylineCollection) || polylineCollection.isDestroyed()) { polylineCollection = new PolylineCollection(); - polylineCollections[sceneId] = polylineCollection; + polylineCollections[polylineCollectionId] = polylineCollection; primitives.add(polylineCollection); } else if (!primitives.contains(polylineCollection)) { primitives.add(polylineCollection); @@ -869,13 +870,14 @@ DynamicGeometryUpdater.prototype.isDestroyed = function () { DynamicGeometryUpdater.prototype.destroy = function () { const geometryUpdater = this._geometryUpdater; - const sceneId = geometryUpdater._scene.id; - const polylineCollection = polylineCollections[sceneId]; + const polylineCollectionId = + geometryUpdater._scene.id + this._primitives._guid; + const polylineCollection = polylineCollections[polylineCollectionId]; if (defined(polylineCollection)) { polylineCollection.remove(this._line); if (polylineCollection.length === 0) { this._primitives.removeAndDestroy(polylineCollection); - delete polylineCollections[sceneId]; + delete polylineCollections[polylineCollectionId]; } } if (defined(this._groundPolylinePrimitive)) {