Fix race condition on error notification
We start loading the resources at the moment we set the style, but we set the callback for error notification at renderStill(), which happen afterwards. If some error occurs in this short window, it was never being notified. Now we save the last error and we check after we set the callback.
This commit is contained in:
@@ -176,6 +176,11 @@ void MapContext::renderStill(StillImageCallback fn) {
|
||||
throw util::Exception("Map is currently rendering an image");
|
||||
}
|
||||
|
||||
if (style->getLastError()) {
|
||||
fn(style->getLastError(), nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
callback = fn;
|
||||
triggerUpdate(Update::RenderStill);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user