CesiumGS / cesium-native

Apache License 2.0
391 stars 200 forks source link

waitInMainThread may fail to terminate if the future waited on is rejected #881

Closed kring closed 1 month ago

kring commented 1 month ago

If you call waitInMainThread on a Future, and then that Future rejects, the waitInMainThread may never return. The problem is that QueuedScheduler::dispatchUntilTaskCompletes registers for task completion with a .then continuation, which isn't called when the task rejects. Fixing this may be as simple as using the overload of .then that takes a async::task instead of the resolved value.