Issue #20437: Fixed 43 potential bugs when deleting objects references.