Open JarrenMorris opened 1 day ago
WebGL context was not being garbage collected as new viewer values were created.
viewer
viewer.destroy() should handle calling these:
viewer.destroy()
viewer.renderer.renderer.dispose() viewer.renderer.renderer.forceContextLoss()
but it is not.
To get the cleanup to work properly, I had to access the private renderer in the class.
renderer
useEffect(() => { return () => { if (viewer && viewer.container && viewer.container.parentNode) { ;(viewer.renderer as unknown as any)?.renderer?.dispose() ;(viewer.renderer as unknown as any)?.renderer?.forceContextLoss() viewer.destroy() } } }, [viewer])
useEffect(() => { return () => { if (viewer && viewer.container && viewer.container.parentNode) { viewer.destroy() } } }, [viewer])
No response
latest
macOS
Chrome
Too many active WebGL contexts. Oldest context will be lost.
Hey! Please, make me a sandbox :)
What happened?
WebGL context was not being garbage collected as new
viewer
values were created.What should have happened?
viewer.destroy()
should handle calling these:but it is not.
Solution
To get the cleanup to work properly, I had to access the private
renderer
in the class.Code
Sandbox Link
No response
Library Version
latest
What operating system are you using?
macOS
What browser are you using?
Chrome
Logs
Interest to fix the bug