On Sat, Mar 26, 2016 at 11:17 PM, <[email protected]> wrote: > I am currently working on an addon for node and it requires libuv's async > feature but somehow I am getting a segfault when creating an async handle > and immediately destroying it. > > Why is this happening and what am I doing wrong? > > > static uv_async_t asyncHandle; > > static void Callback(uv_async_t* handle) { > } > > void Function(const Nan::FunctionCallbackInfo<v8::Value>& info) { > uv_async_init(uv_default_loop(), &asyncHandle, Callback); > } > > void Function2(const Nan::FunctionCallbackInfo<v8::Value>& info) { > uv_close(reinterpret_cast<uv_handle_t*>(&asyncHandle), nullptr); > }
I'm going to guess that your actual code has a `free(asyncHandle)` or `delete asyncHandle` in it? You can't release the handle's memory until the close callback has been called (where you pass nullptr.) -- You received this message because you are subscribed to the Google Groups "libuv" 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]. Visit this group at https://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
