Skip to content
Prev Previous commit
Next Next commit
Trying to fix issue
  • Loading branch information
tbranyen authored and John Haley committed Feb 26, 2015
commit be57dcb67ad4a0fc24b4b5041469f1796324868e
2 changes: 1 addition & 1 deletion generate/scripts/generateNativeCode.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ module.exports = function generateNativeCode() {
});
}
})
});
}).catch(console.log);

};

Expand Down
13 changes: 13 additions & 0 deletions generate/templates/partials/sync_function.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {

{%each args|argsInfo as arg %}
{%endeach%}

{%-- Inside a free call, if the value is already free'd don't do it again.--%}
{% if cppFunctionName == "Free" %}
if (ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->GetValue() != NULL) {
{% endif %}

{%if .|hasReturns %}
{{ return.cType }} result = {%endif%}{{ cFunctionName }}(
{%each args|argsInfo as arg %}
Expand Down Expand Up @@ -67,6 +73,13 @@ from_{{ arg.name }}
}
{%endif%}

{% if cppFunctionName == "Free" %}
// FIXME Stuck here unable to NULL out this->repo
// ObjectWrap::Unwrap<{{ cppClassName }}>(args.This())->SetValue(NULL);
}
{% endif %}


{%each args|argsInfo as arg %}
{%if arg | isOid %}
if (args[{{ arg.jsArg }}]->IsString()) {
Expand Down
1 change: 1 addition & 0 deletions generate/templates/templates/class_content.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ using namespace node;
{% if freeFunctionName %}
if (this->selfFreeing) {
{{ freeFunctionName }}(this->raw);
this->raw = NULL;
}
{% endif %}

Expand Down
6 changes: 5 additions & 1 deletion test/tests/clone.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ describe("Clone", function() {
this.timeout(30000);

beforeEach(function() {
return fse.remove(clonePath);
return fse.remove(clonePath).catch(function(err) {
console.log(err);

throw err;
});
});

afterEach(function(done) {
Expand Down