This use of a persistent handle is safe. Regards, Søren On Mon, Mar 16, 2009 at 10:55 AM, Stephan Beal <[email protected]>wrote:
> > 2009/3/16 Søren Gjesse <[email protected]>: > ... > > referring to the same memory location (e.g. when passing persistent > handles > > by value). When a persistent handle is disposed all references to it > becomes > > invalid. > > It sounds like what i'm doing is safe, but i'll ask to be sure: > > > class CURW // wrapper for db Cursor class > { > public: > ... > static Persistent<Function> js_ctor; > ... > } > > In my init routine: > > if( CURW::js_ctor.IsEmpty() ) > { > CURW::js_ctor = Persistent<Function>::New( > curs.CtorTemplate()->GetFunction() ); > } > > :-? > > Then i'm using js_ctor to instantiate objects in certain functions: > > return CursorWrapper::js_ctor->NewInstance(1, &jobj ) > > :-? > > If i'm not mistaken, that "should" be safe until v8 IsDead()? > > -- > ----- stephan beal > http://wanderinghorse.net/home/stephan/ > > > > --~--~---------~--~----~------------~-------~--~----~ v8-users mailing list [email protected] http://groups.google.com/group/v8-users -~----------~----~----~----~------~----~------~--~---
