question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Removal of CzmlDataSource from Viewer breaks the Viewer

See original GitHub issue

I am using Cesium to display a subset of the Iridium Next constellation, and I am loading sats via the following:

// satData is the valid CZML sent from the backend over the socket
viewer.dataSources.add(Cesium.CzmlDataSource.load(satData)).then(function (datasource) {
                    ds = datasource;
                });

and then I am attempting to remove it when the socket that sent the satData dies as such:

if (viewer.dataSources.contains(ds)) {
            // satData represent whichever data was past to the frontend from the socket that just disconnected
            var removalPromise = viewer.dataSources.remove(ds);
            Cesium.when(removalPromise, function() { console.log('The promise has resolved') });
}

When I get here, ONLY WHEN THERE ARE MULTIPLE SATS IN THE VIEWER (ala satData1, satData2, etc) I get the following error:

DeveloperError: This object was destroyed, i.e., destroy() was called. Error at new DeveloperError  
 (webpack:///./node_modules/cesium/Source/Core/DeveloperError.js?:43:19) at  
 PolylineCollection.throwOnDestroyed (webpack:///./node_modules/cesium/Source/Core/destroyObject.js?:45:19) at
 PrimitiveCollection.update 
 
(webpack:///./node_modules/cesium/Source/Scene/PrimitiveCollection.js?:368:27) at PrimitiveCollection.update  
 
(webpack:///./node_modules/cesium/Source/Scene/PrimitiveCollection.js?:368:27) at PrimitiveCollection.update 
  
(webpack:///./node_modules/cesium/Source/Scene/PrimitiveCollection.js?:368:27) at  
 
updateAndRenderPrimitives (webpack:///./node_modules/cesium/Source/Scene/Scene.js?:2936:27) at  
 
executeCommandsInViewport (webpack:///./node_modules/cesium/Source/Scene/Scene.js?:2775:13) at  
 updateAndExecuteCommands (webpack:///./node_modules/cesium/Source/Scene/Scene.js?:2583:13) 
  
at render (webpack:///./node_modules/cesium/Source/Scene/Scene.js?:3223:9) at tryAndCatchError  
 (webpack:///./node_modules/cesium/Source/Scene/Scene.js?:3243:13)

Apologies for the weird line breaks. Thanks for the help!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
icarter09commented, Sep 16, 2020

I have verified I’m calling viewer.dataSources.remove with the correct argument and it’s not trying to be removed twice. I’ll try to get an example put together at some point.

2reactions
Trylorcommented, Feb 6, 2021

Please look at this example error. It is loading 2 different czmls. A setTimeout is set and will run removeAll() and error. If only one czml is added (the other is commented out) removeAll works fine, as does the individual remove(). I’ve been trying to fix/circumvent this for hours since I’m handcuffed by it. For my application, I’m trying to load and at times remove multiple, much larger czmls and it is necessary I free up memory instead of just hiding them. I believe it has something to do with the time ranges/clock. Because, when I add another czml without time ranges/clock, removeAll() works with that and just one of these timed czmls. I’ve tried removing various parts of the 2nd czml to pursue that theory and still can’t get it to work.

Sandcastle Example

Read more comments on GitHub >

github_iconTop Results From Across the Web

Removal of CzmlDataSource from Viewer breaks the Viewer
I am using Cesium to display a subset of the Iridium Next constellation, and I am loading sats via the following: // satData...
Read more >
CZML dataSource removal breaks viewer - Cesium Community
I am using Cesium to display a subset of the Iridium Next constellation, and I am loading sats via the following: // satData...
Read more >
CzmlDataSource need to be removed before add new data.
I have to update CzmlDataSource but before that i want to remove old one on every ajax call it load new ... viewer.dataSources.remove(dataSource);...
Read more >
How do I call .then after .callMethod returns in Dart?
var viewer = new Cesium.Viewer('cesiumContainer'); viewer.extend(Cesium.viewerDynamicObjectMixin); viewer.dataSources.removeAll(); var czmlDataSource = new ...
Read more >
GitLab - Software Público
Breaking changes. Removed viewerEntityMixin , which was deprecated in Cesium 1.5. Its functionality is now directly part of the Viewer ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found