Handle destroy calls in hide/show events gracefully. Fixes #609