Hi all, I'm using JavaScriptCore for scripting purposes (isolated from webkit), and I'm encountering the following problem:
I would like to store a reference to an anonymous function, and later to be able to call it as a callback, something like this: ---javascript node.schedule("some name", function () { ... }); --- What I'm doing right now is in the definition of node.schedule, I store the context and the function (as a JSValueRef), then when I need to call code in there, I'm doing this: JSObjectRef func = JSValueToObject(storedContext, storedCallback, NULL); JSObjectCallAsFunction(cb->context, func, storedObject, 0, NULL, NULL); It doesn't matter how I store the context/function, it always crashes when trying to either convert the value to object or call the object as function. At first I thought that the function was being garbage collected, but even after protecting it, I still got the crash. My guess is that the context is not the right one, so another question is: what context should I be passing here? What would be the right way to do this? Thanks, -- Rolando Abarca M. http://rolando.cl Phones: +1 (415) 655-1041 +56 (2) 581-4591
_______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev