Hi,

I run into a very strange runtime error in my v8 application. I
managed to track down the issue and I am including a minimal working
sample. This code must be compiled with MSVC and then executed.

I am possibly doing something very wrong here (although GCC way works
ok), but I am unable to find out what is the exact cause of the crash.
The error happens when the line with "TEST" ObjectTemplate gets
executed.

Note that any of the following makes the issue disappear:
 - remove any of the HandleScopes;
 - remove the "throw" portion of JS code in execute2();
 - do not pass the v8::Object::New() to execute2()


Thanks a lot for any assistance,
Ondrej Zara
(code follows)







#include <string>
#include <v8.h>

void execute2(v8::Handle<v8::Object> someObject) {
        v8::HandleScope handle_scope;
        v8::TryCatch tc;

        v8::Script::New(v8::String::New("throw 1;"))->Run();

        if (tc.HasCaught()) { throw std::string("exception"); }
}

 void execute1() {
        v8::HandleScope handle_scope;
        try {
                execute2(v8::Object::New());
        } catch (std::string e) {
        }
}

void create_context() {
        v8::HandleScope handle_scope;
        v8::Context::New(NULL, v8::ObjectTemplate::New())->Enter();
}

int main(int argc, char ** argv) {
        v8::HandleScope handle_scope;

        create_context();
        execute1();
        v8::Handle<v8::ObjectTemplate> TEST = v8::ObjectTemplate::New();

        return 0;
}

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to