Status: New Owner: ---- New issue 262 by sgbeal: SetInternalFieldCount() failure, very sensitive call ordering http://code.google.com/p/v8/issues/detail?id=262
Hello! This works exactly as expected: // Set up prototype: Handle<FunctionTemplate> devCtorTmpl = FunctionTemplate::New(dev_ctor); Local<ObjectTemplate> devInst = devCtorTmpl->InstanceTemplate(); devInst->SetInternalFieldCount(1); Handle<Function> devCtor( devCtorTmpl->GetFunction() ); That's all fine and good and everyone's happy. But if i innocently swap a couple of the lines there: Handle<FunctionTemplate> devCtorTmpl = FunctionTemplate::New(dev_ctor); Handle<Function> devCtor( devCtorTmpl->GetFunction() ); Local<ObjectTemplate> devInst = devCtorTmpl->InstanceTemplate(); devInst->SetInternalFieldCount(1); The result is (when i finally create an instance of the object): # Fatal error in v8::Object::SetInternalField() # Writing internal field out of bounds (i'm writing to internal field #0) It's very surprising behaviour that such a small and seemingly harmless re-ordering of the calls leads to SetInternalFieldCount() failing. Since we're all sharing the same objects here, i would not expect such a small ordering change to make a difference. If this ordering is indeed a hard requirement for implementors, please document it in the API docs. -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev -~----------~----~----~----~------~----~------~--~---
