[node] prevent race condition for renderFinished

This commit is contained in:
Konstantin Käfer
2018-05-18 17:44:59 +02:00
parent 78fdf5c771
commit d5aff7182d

View File

@@ -447,6 +447,12 @@ void NodeMap::startRender(NodeMap::RenderOptions options) {
} }
void NodeMap::renderFinished() { 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; Nan::HandleScope scope;
// We're done with this render call, so we're unrefing so that the loop could close. // We're done with this render call, so we're unrefing so that the loop could close.