mirror of https://gitee.com/bigwinds/arangodb
Make shure we leave all contexts we open in the propper sequence.
This commit is contained in:
parent
26b51b35b8
commit
aa1cdc09e2
|
@ -117,7 +117,7 @@ void ConsoleThread::run () {
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void ConsoleThread::inner () {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent(); // TODO: this may go away.
|
||||
v8::Isolate* isolate = _context->isolate;
|
||||
v8::HandleScope globalScope(isolate);
|
||||
|
||||
// run the shell
|
||||
|
@ -127,6 +127,7 @@ void ConsoleThread::inner () {
|
|||
|
||||
auto localContext = v8::Local<v8::Context>::New(isolate, _context->_context);
|
||||
localContext->Enter();
|
||||
{
|
||||
v8::Context::Scope contextScope(localContext);
|
||||
|
||||
// .............................................................................
|
||||
|
@ -163,14 +164,13 @@ void ConsoleThread::inner () {
|
|||
if (input != nullptr) {
|
||||
TRI_FreeString(TRI_UNKNOWN_MEM_ZONE, input);
|
||||
}
|
||||
throw "user aborted";
|
||||
break;
|
||||
}
|
||||
|
||||
if (input == nullptr) {
|
||||
_userAborted = true;
|
||||
|
||||
// this will be caught by "run"
|
||||
throw "user aborted";
|
||||
localContext->Exit();
|
||||
break;
|
||||
}
|
||||
|
||||
if (*input == '\0') {
|
||||
|
@ -181,6 +181,7 @@ void ConsoleThread::inner () {
|
|||
nrCommands++;
|
||||
console.addHistory(input);
|
||||
|
||||
{
|
||||
v8::TryCatch tryCatch;
|
||||
v8::HandleScope scope(isolate);
|
||||
|
||||
|
@ -191,7 +192,9 @@ void ConsoleThread::inner () {
|
|||
std::cout << TRI_StringifyV8Exception(isolate, &tryCatch);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
localContext->Exit();
|
||||
throw "user aborted";
|
||||
}
|
||||
|
||||
|
|
|
@ -374,6 +374,7 @@ ApplicationV8::V8Context* ApplicationV8::enterContext (std::string const& name,
|
|||
v8::HandleScope scope(isolate);
|
||||
auto localContext = v8::Local<v8::Context>::New(isolate, context->_context);
|
||||
localContext->Enter();
|
||||
{
|
||||
v8::Context::Scope contextScope(localContext);
|
||||
|
||||
TRI_ASSERT(context->_locker->IsLocked(isolate));
|
||||
|
@ -397,7 +398,7 @@ ApplicationV8::V8Context* ApplicationV8::enterContext (std::string const& name,
|
|||
TRI_V8_ASCII_STRING("global context method"),
|
||||
false);
|
||||
}
|
||||
|
||||
}
|
||||
return context;
|
||||
}
|
||||
|
||||
|
@ -505,6 +506,7 @@ void ApplicationV8::exitContext (V8Context* context) {
|
|||
|
||||
delete context->_locker;
|
||||
context->_locker = nullptr;
|
||||
|
||||
TRI_ASSERT(! v8::Locker::IsLocked(isolate));
|
||||
|
||||
guard.broadcast();
|
||||
|
|
Loading…
Reference in New Issue