dispose replaces current object with 0 to avoid use-after-free