This code:
===================
v8::Local<v8::Object> TBDLib::V8New()
{
        using namespace v8;
        HandleScope handle_scope;

        static Persistent<ObjectTemplate> tmpl;
        if(tmpl.IsEmpty())
        { // create on demand
                HandleScope tmplscope;
                Handle<ObjectTemplate> localtmpl = ObjectTemplate::New();
                localtmpl->SetInternalFieldCount(1);
                tmpl = 
Persistent<ObjectTemplate>::New(tmplscope.Close(localtmpl));
        }

        // create object and embed 'this'
        Handle<Object> result = tmpl->NewInstance();
        result->SetInternalField(0, External::New(this));

        return handle_scope.Close(result);
}
======================

Fails on the SetInternalField call with the message:
#
# Fatal error in v8::Object::SetInternalField()
# Writing internal field out of bounds
#

Indeed at that point, result->GetInternalFieldCount() returns 0.  The
question is why.

-- 
Bryan White

--~--~---------~--~----~------------~-------~--~----~
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to