Fix crash when destroying a panel surface