Fix a crash when the view already has a parent.