summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2016-11-29 11:03:25 -0500
committerRamon Fernandez <ramon@mongodb.com>2017-03-17 17:57:20 -0400
commitf07437fb5a6cca07c10bafa78365456eb1d6d5e1 (patch)
tree5629ec37076693d77b6b279346d96febd0f7b597
parent702d1f14e5ed3774279c02464723fdea6d77d31c (diff)
downloadmongo-f07437fb5a6cca07c10bafa78365456eb1d6d5e1.tar.gz
SERVER-27177 initialize kCurrentScope before creating mozjs runtime/scoper3.4.3-rc2r3.4.3
(cherry picked from commit 7cb646696ba926a577a23572afa857b4360b9bac)
-rw-r--r--src/mongo/scripting/mozjs/implscope.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/scripting/mozjs/implscope.cpp b/src/mongo/scripting/mozjs/implscope.cpp
index 6a250c0b897..72de902359a 100644
--- a/src/mongo/scripting/mozjs/implscope.cpp
+++ b/src/mongo/scripting/mozjs/implscope.cpp
@@ -246,6 +246,10 @@ void MozJSImplScope::_gcCallback(JSRuntime* rt, JSGCStatus status, void* data) {
}
MozJSImplScope::MozRuntime::MozRuntime(const MozJSScriptEngine* engine) {
+ // While we're initializing the runtime/scope, calling MozJSImplScope::getThreadScope() should
+ // return a nullptr.
+ kCurrentScope = nullptr;
+
/**
* The maximum amount of memory to be given out per thread to mozilla. We
* manage this by trapping all calls to malloc, free, etc. and keeping track of