Permalink
Browse files

Fix zero length arrays throwing in vc++

  • Loading branch information...
1 parent 3f264ee commit 9ef941d54f63c593e0edea956f4265121e709af4 @Benvie committed Feb 19, 2012
Showing with 10 additions and 12 deletions.
  1. +2 −0 render-templates.js
  2. +3 −4 src-templates/generic.cpp
  3. +2 −2 src/app.cpp
  4. +1 −2 src/wxNodeObject.cpp
  5. +2 −4 src/wxnode_bindings.cpp
View
@@ -826,3 +826,5 @@ function yellow(msg) {
function red(msg) {
return '\u001b[31m' + msg + '\u001b[0m';
}
+
+renderTemplates()
@@ -51,8 +51,8 @@ wxNode_{{parent.parent.name}}::wxNode_{{parent.parent.name}}({{{argDeclCode}}})
wxNode_{{name}}::AddMethods(returnObjFt);
v8::Local<v8::Function> returnObjFn = returnObjFt->GetFunction();
- v8::Handle<v8::Value> returnObjArgs[0];
- v8::Local<v8::Object> returnObj = returnObjFn->CallAsConstructor(0, returnObjArgs)->ToObject();
+
+ v8::Local<v8::Object> returnObj = returnObjFn->CallAsConstructor(0, new v8::Local<v8::Value>[0])->ToObject();
returnObj->SetPointerInInternalField(0, (void*)obj);
NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>((wxNode_{{name}}*)obj);
returnObj->SetPointerInInternalField(1, evtHandler);
@@ -73,8 +73,7 @@ wxNode_{{parent.parent.name}}::wxNode_{{parent.parent.name}}({{{argDeclCode}}})
wxNode_{{name}}::AddMethods(returnObjFt);
v8::Local<v8::Function> returnObjFn = returnObjFt->GetFunction();
- v8::Handle<v8::Value> returnObjArgs[0];
- v8::Local<v8::Object> returnObj = returnObjFn->CallAsConstructor(0, returnObjArgs)->ToObject();
+ v8::Local<v8::Object> returnObj = returnObjFn->CallAsConstructor(0, new v8::Local<v8::Value>[0])->ToObject();
returnObj->SetPointerInInternalField(0, (void*)obj);
NodeExEvtHandlerImplWrap* wrap = new NodeExEvtHandlerImplWrap(returnObj);
NodeExEvtHandlerImpl* evtHandler = dynamic_cast<NodeExEvtHandlerImpl*>(wrap);
View
@@ -37,9 +37,9 @@
return args.This();
}
+
bool NodeWxApp::OnInit() {
- v8::Handle<v8::Value> args[0];
- v8::Handle<v8::Value> result = call("onInit", 0, args);
+ v8::Handle<v8::Value> result = call("onInit", 0, new v8::Local<v8::Value>[0]);
if(result.IsEmpty()) return false;
return result->ToBoolean()->Value();
}
@@ -30,8 +30,7 @@ v8::Handle<v8::Value> wxNodeObject::call(const char *fnName, int argc, v8::Handl
v8::Handle<v8::Object> subClass = argsData->Get(v8::String::New("subClass"))->ToObject();
// create new object
- v8::Local<v8::Value> argv[0];
- result = v8::Object::Cast(*baseClass->CallAsConstructor(0, argv));
+ result = v8::Object::Cast(*baseClass->CallAsConstructor(0, new v8::Local<v8::Value>[0]));
v8::Function* superWrapMethod = v8::Function::Cast(*v8::Context::GetCurrent()->Global()->Get(v8::String::New("__superWrapMethod")));
@@ -64,8 +64,7 @@ extern "C" {
{
v8::Function* newWxSize = v8::Function::Cast(*target->Get(v8::String::New("Size")));
- v8::Local<v8::Value> argv[0];
- v8::Handle<v8::Object> s = newWxSize->CallAsConstructor(0, argv)->ToObject();
+ v8::Handle<v8::Object> s = newWxSize->CallAsConstructor(0, new v8::Local<v8::Value>[0])->ToObject();
v8::Function *initFn = v8::Function::Cast(*s->Get(v8::String::New("init")));
v8::Local<v8::Value> initArgv[2];
initArgv[0] = v8::Number::New(wxDefaultSize.GetWidth());
@@ -76,8 +75,7 @@ extern "C" {
{
v8::Function* newWxPosition = v8::Function::Cast(*target->Get(v8::String::New("Point")));
- v8::Local<v8::Value> argv[0];
- v8::Handle<v8::Object> s = newWxPosition->CallAsConstructor(0, argv)->ToObject();
+ v8::Handle<v8::Object> s = newWxPosition->CallAsConstructor(0, new v8::Local<v8::Value>[0])->ToObject();
v8::Function *initFn = v8::Function::Cast(*s->Get(v8::String::New("init")));
v8::Local<v8::Value> initArgv[2];
initArgv[0] = v8::Number::New(wxDefaultSize.x);

0 comments on commit 9ef941d

Please sign in to comment.