Force webgl context removal in Context.prototype.destroy #12693
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Try to force webgl context loss in Context.prototype.destroy so resources can be cleared when the CesiumWidget/Viewer are destroyed.
Issue number and link
#11533 (#11533)
Testing plan
With this sandcastle below, click "test button" to open a dialog with a cesium viewer inside, and click the "x" button to close it and destroy the viewer. Repeat this process 16 times.
Before, this would have crashed Cesium (specifically on Chrome, I think).
https://sandcastle.cesium.com/#c=nVYLb9s2EP4rhLfBMmrTstMMheMEQ9MNGNChxTJsA+ICpSRKIkKTGkn50SD/fUe9TCpygs0wYOl49913T3ojNiKWQhsUU83K7a0UhjBBFbpGouR8I1D1GdRZdkqtGqcG7RjdU7WYNg/L02kLIkyFf78IcThFlzj80mqkpYgNkwIxwcxt5S1gyQQ9tgpnmABaIuNyC9A4o+ZnTu3j++OviTU/GZ/4Wep0j2of+M9KFvRQp65f5DxaEoYezKfCktUrTw8+iv5TUm3+olHGFytkVEmnvsbeHj2zQ4jwIie1hX/05L46L09OdPN5ExzWkGSKExqV2V0u978osqX6M1V3FJgnELvvoLGKQUsRnPLjHzLwqCUQDRPERrtqc3ZLlIEnIi5wquT2A80UpTqoy3sffpk2lb5fwOMiDMOJlwOpGBw3kL085JQkTGSdq9+IybGRv4OUCB30kBAqmInzc9qzi8u+vpKcnwf3Mu1ZJqVqCId44dfg9KaoKZVoctqKn/wZ0VCUD4xwmUEtUsI1dU9jWQoDB6E/OElrcK7Vx7XGuIvg2VhBwUzQGy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