Foundation: when releasing an object, don't mark as invalid unless it is actually going to be freed!