If I declare this inside a PIKECLASS in a .cmod, I need the canonical:
PIKEFUN void setfoo(void|object foo) { if(THIS->foo) free_object(THIS->foo); if((THIS->foo=foo)) { debug_malloc_touch(THIS->foo); Pike_sp--; /* don't decrease references */ } else pop_stack(); }
to set it.
The question is, should I also free_object() it in the destructor, or does Pike already take care of that somewhere?