On Sat, Apr 23, 2016 at 10:19 PM, Stephen James <[email protected]> wrote:
> Attempting to call from c++ to v8 using async.c using Nan::New<v8::String>()
> I keep ending up with the following
> abort.
>
> void EventConnectedAsync(uv_async_t *handle)
> {
>   if (!EventConnectedCB.IsEmpty())
>   {
>     cout << (char*)handle->data << endl;
>     const char* url = (const char*)handle->data;
>     v8::Local<v8::Value> argv[] = {
> Nan::New<v8::String>(url).ToLocalChecked() };  // at node_nzape_cb.cc:36
>
>     Nan::MakeCallback(Nan::GetCurrentContext()->Global(), EventConnectedCB,
> 1, argv);
>
>     delete [] (char*)handle->data;
>   }
> }
>
> 00007F869F3407B0 _ZL12getBackTracev
> 00007F869F340DE7 _ZL19signalSevereHandleri
> 00007F86A1B66CC9 gsignal
> 00007F86A1B6A0D7 abort
> 0000000000DFB22B _ZN4nodeL12OnFatalErrorEPKcS1_
> 00000000008CA0D4 _ZN2v85Utils16ReportApiFailureEPKcS2_
> 0000000000A9843E _ZN2v88internal11HandleScope6ExtendEPNS0_7IsolateE
> 00000000008E3D00
> _ZN2v88internal11HandleScope12CreateHandleINS0_6ObjectEEEPPT_PNS0_7IsolateES5_
> 0000000000A79A2A
> _ZN2v88internal7Factory19NewRawOneByteStringEiNS0_13PretenureFlagE
> 0000000000A792E2
> _ZN2v88internal7Factory20NewStringFromOneByteENS0_6VectorIKhEENS0_13PretenureFlagE
> 0000000000A79F92
> _ZN2v88internal7Factory17NewStringFromUtf8ENS0_6VectorIKcEENS0_13PretenureFlagE
> 00000000008DA092
> _ZN2v86String11NewFromUtf8EPNS_7IsolateEPKcNS_13NewStringTypeEi
> 00007F869F8FF84F Nan::imp::Factory<v8::String>::New(char const*, int) at
> nan_implementation_12_inl.h:265
> 00007F869F8FFE2B Nan::imp::Factory<v8::String>::return_t
> Nan::New<v8::String, char const*>(char const*) at nan_new.h:208
> 00007F869F901061 EventConnectedAsync(uv_async_s*) at node_nzape_cb.cc:36
> 0000000000FBF91A uv__async_event at async.c:98
> 0000000000FBF9F2 uv__async_io at async.c:138
> 0000000000FCFA34 uv__io_poll at linux-core.c:345
> 0000000000FC04D5 uv_run at core.c:351
> 0000000000E088AF _ZN4node5StartEiPPc
> 00007F86A1B51EC4 __libc_start_main
> Build:  Date:Apr 19 2016 13:26:06  Version:10037
> Aborted (core dumped)
> nzos@nzos-VirtualBox:~/Development/node-nzape$ nodejs
> The program 'nodejs' is currently not installed. You can install it by
> typing:
> sudo apt-get install nodejs
> nzos@nzos-VirtualBox:~/Development/node-nzape$ node --version
> v5.10.1

It looks like you're missing a v8::HandleScope or Nan::HandleScope at
the top of your function.

Aside: using uv_async_t.data like that is potentially unsafe.  You
need proper synchronization (e.g. with a mutex) when multiple threads
access the .data field.  Also, remember there is no 1-to-1
relationship between calls to uv_async_send() and your callback.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CAHQurc8nNBVsWwRvofLjZQWxnO-Dh9tvTwLuDCu1ExUKAkgBEA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to