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).
in main thread i'm initializing v8 calling:
v8::initializeicu(); mplatform = platform::createdefaultplatform(); v8::initializeplatform(mplatform); v8::initialize();
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);
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| }
at line setmessagehandler read access violation
here 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
Post a Comment