diff options
author | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-06-28 13:02:50 +0300 |
---|---|---|
committer | Mikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com> | 2019-06-28 16:33:52 +0300 |
commit | 4c896cbb31fcb929b0e57c7bd02e519c267a1be1 (patch) | |
tree | d1cb53b94bb2feea5b84a6aa722d277ca79f8451 /platform/default | |
parent | 657e847015b28bff01f85f7adbb2cb2dc417fd12 (diff) | |
download | qtlocation-mapboxgl-4c896cbb31fcb929b0e57c7bd02e519c267a1be1.tar.gz |
[core] Fix error handling in HeadlessFrontend::render()
Diffstat (limited to 'platform/default')
-rw-r--r-- | platform/default/src/mbgl/gfx/headless_frontend.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/platform/default/src/mbgl/gfx/headless_frontend.cpp b/platform/default/src/mbgl/gfx/headless_frontend.cpp index 0e97c40e49..f5e6b7f482 100644 --- a/platform/default/src/mbgl/gfx/headless_frontend.cpp +++ b/platform/default/src/mbgl/gfx/headless_frontend.cpp @@ -132,19 +132,24 @@ PremultipliedImage HeadlessFrontend::readStillImage() { PremultipliedImage HeadlessFrontend::render(Map& map) { PremultipliedImage result; + std::exception_ptr error; - map.renderStill([&](std::exception_ptr error) { - if (error) { - std::rethrow_exception(error); + map.renderStill([&](std::exception_ptr e) { + if (e) { + error = e; } else { result = backend->readStillImage(); } }); - while (!result.valid()) { + while (!result.valid() && !error) { util::RunLoop::Get()->runOnce(); } + if (error) { + std::rethrow_exception(error); + } + return result; } |