Fix a error when destroying a view