Skip to content

Commit

Permalink
Copy of Buffer so that Nan does not free it post Nan 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
weareu authored and kant2002 committed Oct 2, 2015
1 parent 15aeb13 commit 8650391
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/image/image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ NAN_METHOD(LwipImage::buffer) {
LwipImage * obj = ObjectWrap::Unwrap<LwipImage>(info.Holder());
// return a new buffer. don't use same memory an image. make a copy.
// image object may be gc'ed, but buffer needs to stay alive.
info.GetReturnValue().Set(Nan::NewBuffer((char *)obj->_cimg->data(), obj->_cimg->size()).ToLocalChecked());
info.GetReturnValue().Set(Nan::CopyBuffer((char *)obj->_cimg->data(), obj->_cimg->size()).ToLocalChecked());
}

// image.resize(width, height, inter, callback):
Expand Down

0 comments on commit 8650391

Please sign in to comment.