Skip to content

Commit

Permalink
Remove destroyed PolylineCollection from Scene CesiumGS#7758
Browse files Browse the repository at this point in the history
Remove PolylineCollections from the Scene before they are destroyed. This causes CesiumGS#7758 and CesiumGS#9154.
  • Loading branch information
rropp5 authored and pupitetris committed Mar 4, 2024
1 parent b29c8ea commit ffa47e3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/engine/Source/DataSources/PolylineGeometryUpdater.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,7 @@ DynamicGeometryUpdater.prototype.destroy = function () {
if (defined(polylineCollection)) {
polylineCollection.remove(this._line);
if (polylineCollection.length === 0) {
removePolylineCollection(geometryUpdater._scene.primitives, polylineCollection);
this._primitives.removeAndDestroy(polylineCollection);
delete polylineCollections[sceneId];
}
Expand All @@ -883,4 +884,16 @@ DynamicGeometryUpdater.prototype.destroy = function () {
}
destroyObject(this);
};

function removePolylineCollection(primitiveCollection, toRemove) {
if (defined(primitiveCollection)) {
if (typeof primitiveCollection.remove === "function") {
primitiveCollection.remove(toRemove);
}

for (let i = 0; i < primitiveCollection.length; i++) {
removePolylineCollection(primitiveCollection.get(i), toRemove);
}
}
};
export default PolylineGeometryUpdater;

0 comments on commit ffa47e3

Please sign in to comment.