summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2017-06-27 13:46:25 -0400
committerAndrew Morrow <acm@mongodb.com>2017-06-28 12:14:41 -0400
commitb5aea02f2d5eed1e75cfde8cf5c7fb5f87bd4f7f (patch)
tree1154fc638189e0c7d0f77bc2c3419db4dc6ce4f1 /src
parent940a6b62189bface6aec2af698e5e9c4149af258 (diff)
downloadmongo-b5aea02f2d5eed1e75cfde8cf5c7fb5f87bd4f7f.tar.gz
SERVER-28839 Unbind the impl from the proxy before terminating the thread
Diffstat (limited to 'src')
-rw-r--r--src/mongo/scripting/mozjs/proxyscope.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/scripting/mozjs/proxyscope.cpp b/src/mongo/scripting/mozjs/proxyscope.cpp
index 78bccb1871b..fec94a88a97 100644
--- a/src/mongo/scripting/mozjs/proxyscope.cpp
+++ b/src/mongo/scripting/mozjs/proxyscope.cpp
@@ -38,6 +38,7 @@
#include "mongo/util/concurrency/idle_thread_block.h"
#include "mongo/util/destructor_guard.h"
#include "mongo/util/quick_exit.h"
+#include "mongo/util/scopeguard.h"
namespace mongo {
namespace mozjs {
@@ -338,6 +339,11 @@ void MozJSProxyScope::implThread(void* arg) {
proxy->_status = exceptionToStatus();
}
+ // This is mostly to silence coverity, so that it sees that the
+ // ProxyScope doesn't hold a reference to the ImplScope after it
+ // is deleted by the unique_ptr.
+ const auto unbindImplScope = MakeGuard([&proxy] { proxy->_implScope = nullptr; });
+
while (true) {
stdx::unique_lock<stdx::mutex> lk(proxy->_mutex);
{