If this method is overridden, it should call the parent last to ensure that allocated resources are properly deallocated.