summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2018-05-18 17:44:59 +0200
committerKonstantin Käfer <mail@kkaefer.com>2018-05-18 17:45:57 +0200
commit0eea0a745846ae110cd780ae6643dd0495cad82c (patch)
treeb52e8795d933f46c6c56e45235b33bb87c3d2e74
parentbe6e40eb683082cb0f3c330179ed59c92a9398aa (diff)
downloadqtlocation-mapboxgl-upstream/node-renderfinished-race-condition.tar.gz
[node] prevent race condition for renderFinishedupstream/node-renderfinished-race-condition
-rw-r--r--platform/node/src/node_map.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 9b76f0f542..521cca1a51 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -447,6 +447,12 @@ void NodeMap::startRender(NodeMap::RenderOptions options) {
}
void NodeMap::renderFinished() {
+ if (!callback) {
+ // In some situations, the render finishes at the same time as we call cancel. Make sure
+ // we are only finishing a render once.
+ return;
+ }
+
Nan::HandleScope scope;
// We're done with this render call, so we're unrefing so that the loop could close.