I do have C++ object typemapped into perl class. Then I have two functions which creates and destroys that object
create_object ($obj); destroy_object ($obj);
first function is easy, I create the object like: c_obj *x=new c_obj; sv_setref_pv( ST(0)), CLASS, (void*)x ); SvSETMAGIC(ST(0));
but the destroy_function has to call delete on the object (sometime, in another thread, I can't stop that), but I don't know how to de-mortalize' variable, in order to stop perl to call destructor on it again. One solution is to create copy of the object and free that copy, but I would like to do it without copying.
Thank you Vladimir Marek