diff options
author | C. Scott Ananian <cscott@cscott.net> | 2014-03-07 00:44:18 +0400 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2014-04-02 12:48:34 +0400 |
commit | 08a5b442e42ff67bd5666604eebe69f1b4a1c919 (patch) | |
tree | ef08abc6ccc5fd1e07494b5074cf8b560c89f3cf /src/signal_wrap.cc | |
parent | d4fcb23e38e74d21e04b3a17d10e52949b630ec0 (diff) |
node: add signature to SET_PROTOTYPE_METHOD
This prevents segfaults when a native method is reassigned to a
different object (which corrupts args.This()). When unwrapping,
clients should use args.Holder() instead of args.This().
Closes #6690.
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'src/signal_wrap.cc')
-rw-r--r-- | src/signal_wrap.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 4f69fc4bee6..e1ec2fd21a7 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -88,7 +88,7 @@ class SignalWrap : public HandleWrap { static void Start(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args.GetIsolate()); HandleScope scope(env->isolate()); - SignalWrap* wrap = Unwrap<SignalWrap>(args.This()); + SignalWrap* wrap = Unwrap<SignalWrap>(args.Holder()); int signum = args[0]->Int32Value(); int err = uv_signal_start(&wrap->handle_, OnSignal, signum); @@ -98,7 +98,7 @@ class SignalWrap : public HandleWrap { static void Stop(const FunctionCallbackInfo<Value>& args) { Environment* env = Environment::GetCurrent(args.GetIsolate()); HandleScope scope(env->isolate()); - SignalWrap* wrap = Unwrap<SignalWrap>(args.This()); + SignalWrap* wrap = Unwrap<SignalWrap>(args.Holder()); int err = uv_signal_stop(&wrap->handle_); args.GetReturnValue().Set(err); |