Preventing recursive destructor call causing segfault (mac/linux).