On Sat, Oct 10, 2009 at 6:38 PM, Scott Sibley
<sisi...@gmail.com> wrote:
Evaluator::~Evaluator() {
v8::V8::Dispose();
plugin_uptime_deinit();
This just feels wrong. Dispose eliminates all v8 resources, but plugin_uptime_deinit() is likely to use Handle<>, and manipulation of handles is not legal once v8 is dead.
void Evaluator::AddFunction(const char *name, v8::Handle<v8::FunctionTemplate> func) {
std::cout << "Adding function " << name << std::endl;
v8::HandleScope handle_scope;
global->Set(name, func); // This is where I get the error mentioned in the email title. I added the above handle_scope but it still gives the error.
}
IMO you shouldn't need a handle scope here.
Any clues? I'm going by the shell example mainly. I'm pretty sure I followed the steps similarly, but they're spread across function/method calls, while the example sets up the functions all in the same C++ scope with initializing the "global" handle. That's the only thing I can figure is the problem.
Here's the exact error I get:
#
# Fatal error in v8::HandleScope::CreateHandle()
# Cannot create a handle without a HandleScope
#
Can you post the whole code, so we can see the order of operations? i remember having to fiddle a lot with the example shell to get the ordering of all operations correct in my own app. v8 can be very choosy about ordering for certain operations, and i suspect this is a simple order-of -setup problem.
Are you getting the error for your first Evaluator object or on subsequent objects? If it's the latter case, it's no surprise because you've destroyed v8 ~Evaluator(). Dispose() does not, as a general rule, need to be called by client apps.
--
----- stephan beal
http://wanderinghorse.net/home/stephan/