I have just tried to create a Visual Studio project like the v8_sample_shell containing your code (actually just putting your code in shell.cc) and added the option /EHsc. It seems to run fine for me in both Debug and Release build. I am using used Visual Studio 2005. I also tried to add option /EHsc to the v8 and v8_base project and that also seemed to work fine. If a turn on break on C++ exceptions in the Visual Studio debugger I also get a break when the C++ exception is thrown. Could you perhaps post some more information on the build options used to make the crash happen?
Regards, Søren On Thu, Oct 22, 2009 at 08:14, ondras <[email protected]> wrote: > > 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 -~----------~----~----~----~------~----~------~--~---
