Fix regression in custom v8 interpreter.
Issue showed up with newer v8 version.
This commit is contained in:
parent
f9268f223c
commit
c2f22bb2b8
1 changed files with 15 additions and 12 deletions
|
|
@ -49,6 +49,8 @@ private:
|
||||||
|
|
||||||
static const char* ToCString(const v8::String::Utf8Value& value);
|
static const char* ToCString(const v8::String::Utf8Value& value);
|
||||||
|
|
||||||
|
virtual bool _ExecuteScript(const std::string& source, const std::string& scriptPath);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
v8::Persistent<v8::Context> context;
|
v8::Persistent<v8::Context> context;
|
||||||
|
|
@ -61,14 +63,9 @@ protected:
|
||||||
#error "implement dll loading"
|
#error "implement dll loading"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
V8Shell::V8Shell()
|
V8Shell::V8Shell(){}
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
V8Shell::~V8Shell() {
|
V8Shell::~V8Shell() {}
|
||||||
context.Dispose();
|
|
||||||
v8::V8::Dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool V8Shell::RunScript(const std::string& scriptPath) {
|
bool V8Shell::RunScript(const std::string& scriptPath) {
|
||||||
|
|
||||||
|
|
@ -84,7 +81,17 @@ bool V8Shell::RunScript(const std::string& scriptPath) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
context->Enter();
|
context->Enter();
|
||||||
//v8::Context::Scope context_scope(context);
|
|
||||||
|
bool success = _ExecuteScript(source, scriptPath);
|
||||||
|
|
||||||
|
context->Exit();
|
||||||
|
context.Dispose();
|
||||||
|
v8::V8::Dispose();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool V8Shell::_ExecuteScript(const std::string& source, const std::string& scriptPath) {
|
||||||
v8::HandleScope scope;
|
v8::HandleScope scope;
|
||||||
|
|
||||||
// Store a pointer to this shell for later use
|
// Store a pointer to this shell for later use
|
||||||
|
|
@ -99,10 +106,6 @@ bool V8Shell::RunScript(const std::string& scriptPath) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
context->Exit();
|
|
||||||
context.Dispose();
|
|
||||||
v8::V8::Dispose();
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue