Hi, scostas wrote: > I've created a new method which receives a function as a parameter, and > stores it in a pointer in C using JSValueToObject(). Then, in my C code, > when I want to inform JavaScript about an event, I call that function > using JSObjectCallAsFunction(). > > My question is: do I have to do something to ensure that the object > never becames invalid because the garbage collector frees it? Let's say > that, instead of a function, it's an object's method, instead. In a > system with reference counters I just should increment it, but with a > garbage collector I have to add a "pointer" inside JavaScript VM, if it > has not been done already... > > The other question is: what do I have to do, when a page is reloaded, to > safely dispose this object and ensure that the JavaScript VM frees it? > Again, with reference counters, I just should decrement it, but with the > garbage collector I'm not sure how to ensure that any possible reference > has been erased.
Hm, I know that it's possible to invoke instance methods on an object via a function pointer and the instance pointer. However, if you store function pointers without knowing an instance, then those can be to static methods only, or am I missing something? If you don't have an object, there is nothing to reference. Best regards, -Stephan _______________________________________________ webkit-help mailing list [email protected] http://lists.webkit.org/mailman/listinfo.cgi/webkit-help
