Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ To use N-API in a native module:
```gyp
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' },
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
},
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
},
Expand Down
8 changes: 4 additions & 4 deletions napi-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ PropertyDescriptor::Accessor(const char* utf8name,
void* data) {
typedef details::CallbackData<Getter, Napi::Value> CbData;
// TODO: Delete when the function is destroyed
auto callbackData = new CbData({ getter });
auto callbackData = new CbData({ getter, nullptr });

return PropertyDescriptor({
utf8name,
Expand Down Expand Up @@ -1994,7 +1994,7 @@ inline PropertyDescriptor PropertyDescriptor::Accessor(napi_value name,
void* data) {
typedef details::CallbackData<Getter, Napi::Value> CbData;
// TODO: Delete when the function is destroyed
auto callbackData = new CbData({ getter });
auto callbackData = new CbData({ getter, nullptr });

return PropertyDescriptor({
nullptr,
Expand Down Expand Up @@ -2088,7 +2088,7 @@ inline PropertyDescriptor PropertyDescriptor::Function(const char* utf8name,
typedef decltype(cb(CallbackInfo(nullptr, nullptr))) ReturnType;
typedef details::CallbackData<Callable, ReturnType> CbData;
// TODO: Delete when the function is destroyed
auto callbackData = new CbData({ cb });
auto callbackData = new CbData({ cb, nullptr });

return PropertyDescriptor({
utf8name,
Expand Down Expand Up @@ -2118,7 +2118,7 @@ inline PropertyDescriptor PropertyDescriptor::Function(napi_value name,
typedef decltype(cb(CallbackInfo(nullptr, nullptr))) ReturnType;
typedef details::CallbackData<Callable, ReturnType> CbData;
// TODO: Delete when the function is destroyed
auto callbackData = new CbData({ cb });
auto callbackData = new CbData({ cb, nullptr });

return PropertyDescriptor({
nullptr,
Expand Down
4 changes: 2 additions & 2 deletions test/arraybuffer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Value CreateExternalBufferWithFinalize(const CallbackInfo& info) {
data,
testLength,
[](Env env, void* finalizeData) {
delete[] finalizeData;
delete[] static_cast<uint8_t*>(finalizeData);
finalizeCount++;
});

Expand All @@ -82,7 +82,7 @@ Value CreateExternalBufferWithFinalizeHint(const CallbackInfo& info) {
data,
testLength,
[](Env env, void* finalizeData, char* finalizeHint) {
delete[] finalizeData;
delete[] static_cast<uint8_t*>(finalizeData);
finalizeCount++;
},
hint);
Expand Down
6 changes: 5 additions & 1 deletion test/binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@
'dependencies': ["<!(node -p \"require('../').gyp\")"],
'cflags!': [ '-fno-exceptions' ],
'cflags_cc!': [ '-fno-exceptions' ],
'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES' },
'xcode_settings': {
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
'CLANG_CXX_LIBRARY': 'libc++',
'MACOSX_DEPLOYMENT_TARGET': '10.7',
},
'msvs_settings': {
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
},
Expand Down