Skip to content

Commit bc77038

Browse files
author
John Haley
committed
Fixed callbacks to be null unless set in structs
1 parent 2b0ee55 commit bc77038

3 files changed

Lines changed: 6 additions & 2 deletions

File tree

generate/templates/partials/field_accessors.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@
4343

4444
{% elsif field.isCallbackFunction %}
4545
if (value->IsFunction()) {
46+
if (!wrapper->raw->{{ field.name }}) {
47+
wrapper->raw->{{ field.name }} = ({{ field.cType }}){{ field.name }}_cppCallback;
48+
}
49+
4650
wrapper->{{ field.name }} = new NanCallback(value.As<Function>());
4751
}
4852

generate/templates/templates/struct_content.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ void {{ cppClassName }}::ConstructFields() {
6363

6464
// Set the static method call and set the payload for this function to be
6565
// the current instance
66-
this->raw->{{ field.name }} = ({{ field.cType }}){{ field.name }}_cppCallback;
66+
this->raw->{{ field.name }} = NULL;
6767
this->raw->{{ fields|payloadFor field.name }} = (void *)this;
6868
this->{{ field.name }} = new NanCallback();
6969
{% elsif field.payloadFor %}

test/tests/diff.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ describe("Diff", function() {
8585
assert.equal(lines[4].contentLen(), 162);
8686
});
8787

88-
it.only("can diff the workdir with index", function() {
88+
it("can diff the workdir with index", function() {
8989
var patches = this.workdirDiff.patches();
9090
assert.equal(patches.length, 1);
9191
assert(patches[0].isUntracked());

0 commit comments

Comments
 (0)