Hi,

when you create a context before initializing an isolate, it is
created inside the default isolate. You lose access to this context
once you switch to a new isolate. The developer shell d8 offers an
example: for each isolate you have to create its own context.
Unfortunately, I don't there there is a way to share object templates
across isolates.

Regards,

Yang

On Sep 23, 2:58 pm, dw <[email protected]> wrote:
> Hi,
>
> I am customizing ObjectTemplates so the objects have all the necessary
> bindings.
>
> Here is how I create the Object Template:
>
>         Handle<ObjectTemplate> aTempl = ObjectTemplate::New();
>     // Set method bindings
>         aTempl->Set(String::New("trace"), v8::FunctionTemplate::New(Trace));
>     .
>     .
>
> I cache the ObjectTempate to a static Persistent<ObjectTemplat> in my
> class so I can avoid re-creating the template every time I use the
> object.
>                 sObjectTemplate = Persistent<ObjectTemplate>::New(aTempl);
>
> Later, when I try to create an instance of the object from within an
> Isolate:
>
>     Handle<Object> anInstance = sObjectTemplate->NewInstance();
>
> the app crashes with an access violation in Handle<JSObject>
> Execution::InstantiateObject.
>
> I know I am doing something wrong, but what exactly? The code works
> correctly when not using Isolates.
>
> Is it possible to share ObjectTemplates among Isolates?
>
> TIA,
> DW

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

Reply via email to