From f250a366c77c988709497edbefd89e9e7193475e Mon Sep 17 00:00:00 2001 From: Valerii Iatsko Date: Thu, 25 Feb 2016 11:55:27 +0100 Subject: [PATCH 1/3] Fix compilation for systems != windows and crash in diff function --- vendor/libgit2.gyp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/vendor/libgit2.gyp b/vendor/libgit2.gyp index bc8267513..8880a2438 100644 --- a/vendor/libgit2.gyp +++ b/vendor/libgit2.gyp @@ -333,6 +333,9 @@ # 'InterlockedDecrement' undefined; assuming extern returning int. 4013, ], + "include_dirs": [ + "libgit2/deps/regex" + ], "sources": [ "libgit2/src/win32/w32_buffer.c", "libgit2/src/win32/w32_buffer.h", @@ -390,8 +393,7 @@ ], "include_dirs": [ "libgit2/include", - "libgit2/src", - "libgit2/deps/regex" + "libgit2/src" ], "direct_dependent_settings": { "include_dirs": [ @@ -427,9 +429,15 @@ "STDC", "NO_GZIP", ], + "conditions": [ + ["OS=='win'", { + "include_dirs": [ + "libgit2/deps/regex" + ] + }] + ], "include_dirs": [ - "libgit2/include", - "libgit2/deps/regex", + "libgit2/include" ], "direct_dependent_settings": { "include_dirs": [ From 918e47b28e00bf86099fc5d3beb25c884ea611d4 Mon Sep 17 00:00:00 2001 From: John Haley Date: Thu, 25 Feb 2016 09:20:15 -0700 Subject: [PATCH 2/3] Remove `GetRefValue` Using `GetRefValue` would return the V8 handled pointer instead of the pointer to the libgit2 value and the V8 handled pointer could be changed at any moment. Removing this function and setting the pointer value to the underlying C object will prevent V8 GC screwing up a NodeGit app. --- generate/templates/partials/convert_from_v8.cc | 12 ++---------- generate/templates/templates/class_content.cc | 4 ---- generate/templates/templates/class_header.h | 1 - generate/templates/templates/struct_content.cc | 6 +----- generate/templates/templates/struct_header.h | 1 - 5 files changed, 3 insertions(+), 21 deletions(-) diff --git a/generate/templates/partials/convert_from_v8.cc b/generate/templates/partials/convert_from_v8.cc index fc85edf7d..659e2fb0e 100644 --- a/generate/templates/partials/convert_from_v8.cc +++ b/generate/templates/partials/convert_from_v8.cc @@ -69,18 +69,10 @@ {%endif%} } else { - {%if cType|isDoublePointer %} - from_{{ name }} = Nan::ObjectWrap::Unwrap<{{ cppClassName }}>(info[{{ jsArg }}]->ToObject())->GetRefValue(); - {%else%} - from_{{ name }} = Nan::ObjectWrap::Unwrap<{{ cppClassName }}>(info[{{ jsArg }}]->ToObject())->GetValue(); - {%endif%} + {%if cType|isDoublePointer %}*{%endif%}from_{{ name }} = Nan::ObjectWrap::Unwrap<{{ cppClassName }}>(info[{{ jsArg }}]->ToObject())->GetValue(); } {%else%} - {%if cType|isDoublePointer %} - from_{{ name }} = Nan::ObjectWrap::Unwrap<{{ cppClassName }}>(info[{{ jsArg }}]->ToObject())->GetRefValue(); - {%else%} - from_{{ name }} = Nan::ObjectWrap::Unwrap<{{ cppClassName }}>(info[{{ jsArg }}]->ToObject())->GetValue(); - {%endif%} + {%if cType|isDoublePointer %}*{%endif%}from_{{ name }} = Nan::ObjectWrap::Unwrap<{{ cppClassName }}>(info[{{ jsArg }}]->ToObject())->GetValue(); {%endif%} {%if isBoolean %} diff --git a/generate/templates/templates/class_content.cc b/generate/templates/templates/class_content.cc index 969e88473..bda244812 100644 --- a/generate/templates/templates/class_content.cc +++ b/generate/templates/templates/class_content.cc @@ -109,10 +109,6 @@ using namespace node; return this->raw; } - {{ cType }} **{{ cppClassName }}::GetRefValue() { - return this->raw == NULL ? NULL : &this->raw; - } - void {{ cppClassName }}::ClearValue() { this->raw = NULL; } diff --git a/generate/templates/templates/class_header.h b/generate/templates/templates/class_header.h index a378f11a5..11316c51f 100644 --- a/generate/templates/templates/class_header.h +++ b/generate/templates/templates/class_header.h @@ -44,7 +44,6 @@ class {{ cppClassName }} : public Nan::ObjectWrap { {%if cType%} {{ cType }} *GetValue(); - {{ cType }} **GetRefValue(); void ClearValue(); static Local New(void *raw, bool selfFreeing); diff --git a/generate/templates/templates/struct_content.cc b/generate/templates/templates/struct_content.cc index e2e399d98..b6ab0f16b 100644 --- a/generate/templates/templates/struct_content.cc +++ b/generate/templates/templates/struct_content.cc @@ -62,7 +62,7 @@ using namespace std; {% endif %} {% endif %} {% endeach %} - + if (this->selfFreeing) { free(this->raw); } @@ -143,10 +143,6 @@ Local {{ cppClassName }}::New(void* raw, bool selfFreeing) { return this->raw; } -{{ cType }} **{{ cppClassName }}::GetRefValue() { - return this->raw == NULL ? NULL : &this->raw; -} - void {{ cppClassName }}::ClearValue() { this->raw = NULL; } diff --git a/generate/templates/templates/struct_header.h b/generate/templates/templates/struct_header.h index c1f30cc4e..d15bf677c 100644 --- a/generate/templates/templates/struct_header.h +++ b/generate/templates/templates/struct_header.h @@ -29,7 +29,6 @@ class {{ cppClassName }} : public Nan::ObjectWrap { static void InitializeComponent (Local target); {{ cType }} *GetValue(); - {{ cType }} **GetRefValue(); void ClearValue(); static Local New(void *raw, bool selfFreeing); From da9c6c5c7b972f6c51765b7560f8c6c24482dc3d Mon Sep 17 00:00:00 2001 From: John Haley Date: Thu, 25 Feb 2016 09:24:43 -0700 Subject: [PATCH 3/3] Bump to 0.11.5 --- CHANGELOG.md | 7 +++++++ README.md | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f84cf9ecb..aa8665ce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Change Log +## [0.11.5](https://github.com/nodegit/nodegit/releases/tag/v0.11.5) (2016-02-25) + +[Full Changelog](https://github.com/nodegit/nodegit/compare/v0.11.4...v0.11.5) + +- Fixed crash when calculating a diff [PR #922](https://github.com/nodegit/nodegit/pull/922) +- Fixed an issue with return values getting randomly corrupted [PR #923](https://github.com/nodegit/nodegit/pull/923) + ## [0.11.4](https://github.com/nodegit/nodegit/releases/tag/v0.11.4) (2016-02-24) [Full Changelog](https://github.com/nodegit/nodegit/compare/v0.11.3...v0.11.4) diff --git a/README.md b/README.md index ed8126910..b7caa80ec 100644 --- a/README.md +++ b/README.md @@ -31,7 +31,7 @@ NodeGit -**Stable: 0.11.4** +**Stable: 0.11.5** ## Have a problem? Come chat with us! ## diff --git a/package.json b/package.json index c7bab17cb..ab30d68af 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nodegit", "description": "Node.js libgit2 asynchronous native bindings", - "version": "0.11.4", + "version": "0.11.5", "homepage": "http://nodegit.org", "keywords": [ "libgit2",