[webkit-help] how to free a function callback
superstippi at gmx.de
Mon Apr 5 15:50:02 PDT 2010
> 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,
> 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
> has not been done already...
> The other question is: what do I have to do, when a page is reloaded, to
> 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.
More information about the webkit-help