Fix a bug with wx firing events after a widget is destroyed.