Could somebody let me know how to use SetInternalField() to global?

86 views
Skip to first unread message

amourfou

unread,
Apr 23, 2014, 9:26:42 PM4/23/14
to v8-u...@googlegroups.com
I have following codes.

1 : m_pIsolate = v8Isolate::GetCurrent();

2 : v8::HandleScope handle_scope(m_pIsolate);

3 : v8::Handle<v8::ObjectTemplate> global = v8::Persistent<v8::ObjectTemplate>::New(GetIsolate(), v8::ObjectTemplate::New());

4 : m_context = v8::Context::New(NULL, global);

5 : v8::Context::Scope context_scope(m_context);

6 : global->SetInternalFieldCount(1);
7 : v8::Handle<v8Object>  lglobal = global->NewInstance();
8 : lglobal->SetInternalField(0, v8External::New(this));

But, in 8 line there is an error(debug break) the following

#
# Fatal error in v8::Object::SetInternalField()
# Internal field out of bounds
#

How can I resolve this problem? help~~

Ben Noordhuis

unread,
Apr 24, 2014, 2:05:32 AM4/24/14
to v8-u...@googlegroups.com
I think you need to make the call to global->SetInternalFieldCount()
before passing global to Context::New().
Reply all
Reply to author
Forward
0 new messages