File tree Expand file tree Collapse file tree 3 files changed +9
-22
lines changed
Expand file tree Collapse file tree 3 files changed +9
-22
lines changed Original file line number Diff line number Diff line change @@ -19,16 +19,12 @@ NAN_METHOD({{ cppClassName }}::{{ cppFunctionName }}) {
1919 {%if not arg.payloadFor %}
2020 {%partial convertFromV8 arg %}
2121 {%if arg.saveArg %}
22- Persistent<Object> {{ arg.name }};
23- Handle<Object> {{ arg.name }}Handle (args[{{ arg.jsArg }}]->ToObject ());
24- NanAssignPersistent ({{ arg.name }}, {{ arg.name }}Handle);
22+ Handle<Object> {{ arg.name }}(args[{{ arg.jsArg }}]->ToObject ());
2523 {{ cppClassName }} *thisObj = ObjectWrap::Unwrap<{{ cppClassName }}>(args.This ());
2624
27- if (thisObj->{{ cppFunctionName }}_{{ arg.name }} != NULL ) {
28- NanDisposePersistent (*thisObj->{{ cppFunctionName }}_{{ arg.name }});
29- }
25+ NanDisposePersistent (thisObj->{{ cppFunctionName }}_{{ arg.name }});
3026
31- thisObj->{{ cppFunctionName }}_{{ arg.name }} = & {{ arg.name }};
27+ NanAssignPersistent ( thisObj->{{ cppFunctionName }}_{{ arg.name }}, {{ arg.name }}) ;
3228 {%endif%}
3329 {%endif%}
3430 {%endif%}
Original file line number Diff line number Diff line change @@ -29,16 +29,6 @@ using namespace node;
2929 {{ cppClassName }}::{{ cppClassName }}({{ cType }} *raw, bool selfFreeing) {
3030 this ->raw = raw;
3131 this ->selfFreeing = selfFreeing;
32-
33- {% each functions as function %}
34- {% if not function.ignore %}
35- {% each function.args as arg %}
36- {% if arg.saveArg %}
37- {{ function.cppFunctionName }}_{{ arg.name }} = NULL ;
38- {% endif %}
39- {% endeach %}
40- {% endif %}
41- {% endeach %}
4232 }
4333
4434 {{ cppClassName }}::~{{ cppClassName }}() {
@@ -51,17 +41,18 @@ using namespace node;
5141 // this will cause an error if you have a non-self-freeing object that also needs
5242 // to save values. Since the object that will eventually free the object has no
5343 // way of knowing to free these values.
54- {% each function as function %}
44+ {% each functions as function %}
5545 {% if not function.ignore %}
5646 {% each function.args as arg %}
5747 {% if arg.saveArg %}
58- if ({{ function. cppFunctionName }}_{{ arg. name }} != NULL ) {
59- NanDisposePersistent (& {{ function.cppFunctionName }}_{{ arg.name }});
60- }
48+
49+ NanDisposePersistent ({{ function.cppFunctionName }}_{{ arg.name }});
50+
6151 {% endif %}
6252 {% endeach %}
6353 {% endif %}
6454 {% endeach %}
55+
6556 }
6657
6758 void {{ cppClassName }}::InitializeComponent(Handle<v8::Object> target) {
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ class {{ cppClassName }} : public ObjectWrap {
8787 {% if not function.ignore %}
8888 {% each function.args as arg %}
8989 {% if arg.saveArg %}
90- Persistent<Object> * {{ function.cppFunctionName }}_{{ arg.name }};
90+ Persistent<Object> {{ function.cppFunctionName }}_{{ arg.name }};
9191 {% endif %}
9292 {% endeach %}
9393 {% endif %}
You can’t perform that action at this time.
0 commit comments