Tobias S. Josefowitz @ Pike developers forum wrote:
They may work, but only in the sense that you are shielding yourself from the worst consequences of undefined/use-after-free/... memory access. Both your changes, the one checking io->output's type to be PIKE_T_FUNCTION and the CHECK_DESTRUCTED stuff are of this nature, you are guarding against stuff that is not supposed to happen.
Well, for the CHECK_DESTRUCTED stuff, I agree. The PIKE_T_FUNCTION check could be considered an optimisation. The type already changes from PIKE_T_FUNCTION to something else, so setting it explicitly to zero is extra work.
Your changes should thus all be reverted and the real issue(s) should be identified and fixed.
Agreed. The trouble is finding them. The problems are triggered by destruct-races, and therefore hard to reproduce under controlled circumstances.