Using node::Buffer::Copy() instead of node::Buffer::New() to copy the handle bytes...
authorMichael Vasseur <michael_vasseur@outlook.com>
Sun, 7 Feb 2016 09:20:38 +0000 (10:20 +0100)
committerMichael Vasseur <michael_vasseur@outlook.com>
Sun, 7 Feb 2016 09:20:38 +0000 (10:20 +0100)
atom/browser/api/atom_api_window.cc

index bcf6ccc..ea1d95b 100644 (file)
@@ -109,7 +109,7 @@ void TranslateOldOptions(v8::Isolate* isolate, v8::Local<v8::Object> options) {
 
 // Converts binary data to Buffer.
 v8::Local<v8::Value> ToBuffer(v8::Isolate* isolate, void* val, int size) {
-  auto buffer = node::Buffer::New(isolate, static_cast<char*>(val), size);
+  auto buffer = node::Buffer::Copy(isolate, static_cast<char*>(val), size);
   if (buffer.IsEmpty())
     return v8::Null(isolate);
   else