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-22 11:02:51 +0200
commitd5aff7182d6caca9c69514df5fa90bfc203cb5e8 (patch)
tree21ae5ee9201f1fa00f2a982f1f210ace6a77abcc
parent78fdf5c7716ee7c79800b51713f30f1772514dc6 (diff)
downloadqtlocation-mapboxgl-d5aff7182d6caca9c69514df5fa90bfc203cb5e8.tar.gz
[node] prevent race condition for renderFinished
-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.