mirror of https://github.com/nodejs/node.git
handle_wrap: properly don't abort on unwrap
From commit 756ae2c
all the WRAP/UNWRAP were moved to a single location
for ease of use. In a single location NO_ABORT should have been used but
wasn't. This caused HandleWrap::Close to abort. Below is the applicable
code change as demonstration there was no abort specified when
unwrapping the object.
void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleScope scope(node_isolate);
- HandleWrap *wrap = static_cast<HandleWrap*>(
- args.This()->GetAlignedPointerFromInternalField(0));
+ HandleWrap* wrap;
+ UNWRAP(args.This(), HandleWrap, wrap);
Also included a test that will reproduce the abort.
pull/5010/head
parent
6df4741f84
commit
f218d94af4
|
@ -68,7 +68,7 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
|
|||
HandleScope scope(node_isolate);
|
||||
|
||||
HandleWrap* wrap;
|
||||
NODE_UNWRAP(args.This(), HandleWrap, wrap);
|
||||
NODE_UNWRAP_NO_ABORT(args.This(), HandleWrap, wrap);
|
||||
|
||||
// guard against uninitialized handle or double close
|
||||
if (wrap == NULL || wrap->handle__ == NULL) return;
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright Joyent, Inc. and other Node contributors.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
// persons to whom the Software is furnished to do so, subject to the
|
||||
// following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included
|
||||
// in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
||||
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
var common = require('../common');
|
||||
|
||||
process.on('uncaughtException', function() { });
|
||||
|
||||
setTimeout(function() {
|
||||
process.nextTick(function() {
|
||||
var c = setInterval(function() {
|
||||
clearInterval(c);
|
||||
throw new Error('setInterval');
|
||||
});
|
||||
});
|
||||
setTimeout(function() {
|
||||
throw new Error('setTimeout');
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue