diff options
author | Fedor Indutny <fedor@indutny.com> | 2014-10-24 19:46:25 +0400 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-10-28 21:10:28 -0400 |
commit | 10d0dbc4274dccdcc59ed6d2cd70e7e4267453ee (patch) | |
tree | 78257e36db5cf4aa1f621ee8d670c2c761aaee04 /src/handle_wrap.h | |
parent | b782ef85f1b53384c884050c220efba3dd442bec (diff) | |
download | node-new-10d0dbc4274dccdcc59ed6d2cd70e7e4267453ee.tar.gz |
stream_wrap: do not crash if handle was closed
Ignore cases where the handle is already gone, like we do in
`handle_wrap.cc`. It should be safe to close handle and then call some
binding methods on it, since the internal handle may be shared between
`_tls_wrap.js` and `net.js` modules.
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
PR-URL: https://github.com/node-forward/node/pull/37
Diffstat (limited to 'src/handle_wrap.h')
-rw-r--r-- | src/handle_wrap.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 40ee75cd81..13457e7cc5 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -57,7 +57,11 @@ class HandleWrap : public AsyncWrap { static void Ref(const v8::FunctionCallbackInfo<v8::Value>& args); static void Unref(const v8::FunctionCallbackInfo<v8::Value>& args); - inline uv_handle_t* GetHandle() { return handle__; } + static inline bool IsAlive(const HandleWrap* wrap) { + return wrap != nullptr && wrap->GetHandle() != nullptr; + } + + inline uv_handle_t* GetHandle() const { return handle__; } protected: HandleWrap(Environment* env, |