It can happen that the widget is destroyed without being hidden before. QObject::destroyed is send before the event. So just handle it there. (cherry picked from commit 9439013d)