c++ - Read access violation while using v8::Debug::SetMessageHandler -


i'm trying implement v8 debugger in qt application exception.

i have 2 threads: main (that handle gui , debugger commands) , engine thread (that run javascript code).

  1. in main thread i'm initializing v8 calling:

    v8::initializeicu(); mplatform = platform::createdefaultplatform(); v8::initializeplatform(mplatform); v8::initialize(); 
  2. i'm creating isolate in engine thread:

    arraybufferallocator* allocator = new arraybufferallocator(); isolate::createparams create_params; create_params.array_buffer_allocator = allocator; isolate = isolate::new(create_params); 
  3. in main thread i'm using setmessagehandler

    isolate->enter(); v8::debug::setmessagehandler(handlemessage);  // handlmessage function:  void handlemessage(const v8::debug::message& message) {     v8::string::utf8value response(message.getjson());     // todo |response| } 
  4. at line setmessagehandler read access violation

    here call stack:

    call stack

fwiw i'd asked on v8-users discussion group also. (no answers yet)

thanks in advance!

as ben noordhuis answered me here should use v8::locker synchronize isolates between threads. here example. also, there missing of isolate->exit() after v8::debug::setmessagehandler(handlemessage);


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -