Hello. I built an application using Resium which uses several models, tilesets, polyline and polygons.
All are components under the Viewer component. What is the right way to exit from the whole Cesium component?
When i try to destroy the models i get this error that crashes my app:
An error occurred while rendering. Rendering has stopped.
DeveloperError: This object was destroyed, i.e., destroy() was called.
Error
at new DeveloperError (http://localhost:3000/cesium/Cesium.js:82:23 )
at Model.throwOnDestroyed (http://localhost:3000/cesium/Cesium.js:29066:23 )
at PrimitiveCollection.update (http://localhost:3000/cesium/Cesium.js:131116:31 )
at updateAndRenderPrimitives (http://localhost:3000/cesium/Cesium.js:237416:31 )
at executeCommandsInViewport (http://localhost:3000/cesium/Cesium.js:237250:17 )
at Scene.updateAndExecuteCommands (http://localhost:3000/cesium/Cesium.js:237058:17 )
at render (http://localhost:3000/cesium/Cesium.js:237721:19 )
at tryAndCatchError (http://localhost:3000/cesium/Cesium.js:237740:17 )
at Scene.render (http://localhost:3000/cesium/Cesium.js:237815:17 )
at CesiumWidget.render (http://localhost:3000/cesium/Cesium.js:250280:29 )
Thank you very much
omar
February 23, 2021, 5:59pm
2
This sounds like you’re possibly destroying the same model twice. I would double check if what you’re destroying has already been destroyed and/or run the browser debugger to see what leads to this error being thrown.
Im using one React component that includes inside 2 model components from Resium. They both share the same model Url. Do you think That might have something to do with this?
Thanks alot
rropp5
November 17, 2023, 11:19pm
4
There’s a good chance this is cause by this bug that has been around for 4+ years.
opened 09:55PM - 18 Apr 19 UTC
type - bug
category - data sources
[Forum link](https://groups.google.com/d/msg/cesium-dev/GZYRiB9385k/MoAf7s9BCAAJ… )
[Sandcastle](https://cesiumjs.org/Cesium/Build/Apps/Sandcastle/#c=tVPLbtswEPwVwhfLiEtJTIoUtWy0cXIL0CJue4lyYKS1Q4QiDZJS4Ab+9/LhKoorGC7S8iCJO7uL2dlRQxVaS61TNEW379L0PU7G6PTcPnOBuqfFSB+WnHvstBcjHksPYLbz3SQXjSVTUkMXslYFOEoCntAcNKsrPK+1kdVlC0ejXUVBOb+nxeN+/i78Vck1KLOJlrUoDJMCRYZVMEYKdM3NCD0HVkupUOT6MdsnmdhXFpTBHMTKPNjIyZS06e54+JbdoRNbgdNJQLbhpcDUSrywUcZ+UXGKl8qOASsFoD8rRTeRbzOaoFxsx2hJuQY3WkcIDMIww0BjWpbRjsBa8g1nAtDHPUrMDaltuBWmo3scdzOOJtfpUFEDilHeKZdcKnxzddnOv3UDhO24ehLMlXxwyz7rN1ByADvzWNJnEvKXJiH/xyTksEnIvzEJOWAS8kaTkLeahBxjkovr71d9LmkYPIF6vZsfPhYNC3+dS2GonUQN/Uo9hl/GD1N3/pmjskhgsKCiLKg2HBz+TUqriLqojZEiGt5AJRsYWtF31oja9fb0Vz57n0gQ9Zh0z8gKMxgPMm02HGah+hOr1lIZVCseYRwbqNbcaqzj+7p4BIMLrV1lFv8uykrWIFZO88GefvkAFZxqbZFlzfmC/YR8MMtim/+qjEtaMrH60oDidONSHtLZdQhijLPYXv+sMkG8Tsdf)
Clicking "remove" will throw the following error (I'm showing the unminified error):
```
DeveloperError: This object was destroyed, i.e., destroy() was called.
Error
at new DeveloperError (http://localhost:8080/Source/Core/DeveloperError.js:43:19)
at PolylineCollection.throwOnDestroyed (http://localhost:8080/Source/Core/destroyObject.js:45:19)
at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:369:27)
at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:369:27)
at PrimitiveCollection.update (http://localhost:8080/Source/Scene/PrimitiveCollection.js:369:27)
at updateAndRenderPrimitives (http://localhost:8080/Source/Scene/Scene.js:2937:27)
at executeCommandsInViewport (http://localhost:8080/Source/Scene/Scene.js:2776:13)
at updateAndExecuteCommands (http://localhost:8080/Source/Scene/Scene.js:2584:13)
at render (http://localhost:8080/Source/Scene/Scene.js:3224:9)
at tryAndCatchError (http://localhost:8080/Source/Scene/Scene.js:3244:13)
```
This only happens under very specific conditions. It will NOT happen if:
* You comment out one of the datasources.add lines like `viewer.dataSources.add(dataSource2);`
* If only one of the entities has a callback property (try uncommenting the positions line `positions : Cesium.Cartesian3.fromDegreesArray(poss1)`)
It also works fine if you remove the entities directly from each dataSource, as opposed to removing the dataSource itself.
There aren't any Sandcastle examples using CustomDataSource to group entities this way, so I'm not sure if this is expected. My workaround is to just store the entities yourself in an array and handle iterating through and removing when you need to remove a group.
This is another bug report that has been open for 3+ years and I believe is caused by the same problematic code.
opened 09:29PM - 15 Sep 20 UTC
type - bug
category - data sources
category - czml
Using CZML data sources to display satellites, I am able to remove one datasourc… e from viewer.dataSources. But when I attempt to remove N datasources, Cesium fails. I have linked to this ticket which explains the exact issue I'm running into.
#7632
_I'll try to create a Sandcastle example of this._
Browser: latest Chrome
Operating System: Windows 10
1 Like
anneg
January 16, 2024, 3:29pm
5
And your fix was just merged, nice!
CesiumGS:main
← rropp5:main
opened 05:17AM - 21 Nov 23 UTC
PolylineCollections are destroyed by the PolylineGeometryUpdater but are still a… vailable on the Scene and cause Cesium to stop rendering when they are accessed.
This commit ensures the destroyed PolylineCollections are removed from the Scene in the destroy function of PolylineGeometryUpdater so they are not evaluated in the next render cycle of the Scene.
This resolves the crashes reported under #7758 and #9154.