It can happen that the widget is destroyed without being hidden before. QObject::destroyed is send before the event. So just handle it there.
mentioned in commit e370403c