Fix crash when deleting a QMenu on exit

If the application object is an ancestor of QMenu, dereferencing qApp
in its destructor will cause a crash.

Task-number: QTBUG-30756
Change-Id: I31a33db0fd783bb210a420618911ea8b412e9a0f
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
This commit is contained in:
Gabriel de Dietrich 2013-04-23 12:01:01 +02:00 committed by The Qt Project
parent a7ce34dba4
commit e324f5bc0e

View File

@ -172,7 +172,7 @@ void QWidget::destroy(bool destroyWindow, bool destroySubWindows)
parentWidget()->d_func()->invalidateBuffer(d->effectiveRectFor(geometry()));
d->deactivateWidgetCleanup();
if ((windowType() == Qt::Popup))
if ((windowType() == Qt::Popup) && qApp)
qApp->d_func()->closePopup(this);
if (this == QApplicationPrivate::active_window)