I'm working on my Objective C bridge, and I'm running into a problem that doesn't make a whole lot of sense to me.
I have an object that I am calling f_index() on to see if a function exists in the object, and while f_index() is returning an svalue that says it has a function in it, the callable seems to be invalid, as accessing things in it causes a segfault.
I think I'm adding refs as appropriate to the program and object that the function lives in. Do I need to do anything to the function itself (which is in an object derived from a pure pike class)?
push_object(pobject); push_text(funname); f_index(2);
free(funname);
if(Pike_sp[-1].type == PIKE_T_FUNCTION) // jackpot! { fun = Pike_sp[-1].u.efun; printf("-> get_func_by_selector(%s)\n", fun->name->str); // we segfault here add_ref(fun); pop_stack(); return fun; } else return 0;
It might also be worth noting that I'm creating instances of my class using the following:
struct object * pobject; pobject = clone_object(prog, 0); add_ref(pobject);
object_setInstanceVariable(obj, "pobject", pobject);
pike-devel@lists.lysator.liu.se