Skip to content

Commit be57dcb

Browse files
tbranyenJohn Haley
authored andcommitted
Trying to fix issue
1 parent 0e80c58 commit be57dcb

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

generate/scripts/generateNativeCode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ module.exports = function generateNativeCode() {
144144
});
145145
}
146146
})
147-
});
147+
}).catch(console.log);
148148

149149
};
150150

generate/templates/partials/sync_function.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
3030

3131
{%each args|argsInfo as arg %}
3232
{%endeach%}
33+
34+
{%-- Inside a free call, if the value is already free'd don't do it again.--%}
35+
{% if cppFunctionName == "Free" %}
36+
if (ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->GetValue() != NULL) {
37+
{% endif %}
38+
3339
{%if .|hasReturns %}
3440
{{ return.cType }} result = {%endif%}{{ cFunctionName }}(
3541
{%each args|argsInfo as arg %}
@@ -67,6 +73,13 @@ from_{{ arg.name }}
6773
}
6874
{%endif%}
6975

76+
{% if cppFunctionName == "Free" %}
77+
// FIXME Stuck here unable to NULL out this->repo
78+
// ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->SetValue(NULL);
79+
}
80+
{% endif %}
81+
82+
7083
{%each args|argsInfo as arg %}
7184
{%if arg | isOid %}
7285
if (args[{{ arg.jsArg }}]->IsString()) {

generate/templates/templates/class_content.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ using namespace node;
3535
{% if freeFunctionName %}
3636
if (this->selfFreeing) {
3737
{{ freeFunctionName }}(this->raw);
38+
this->raw = NULL;
3839
}
3940
{% endif %}
4041

test/tests/clone.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,11 @@ describe("Clone", function() {
1818
this.timeout(30000);
1919

2020
beforeEach(function() {
21-
return fse.remove(clonePath);
21+
return fse.remove(clonePath).catch(function(err) {
22+
console.log(err);
23+
24+
throw err;
25+
});
2226
});
2327

2428
afterEach(function(done) {

0 commit comments

Comments
 (0)