QMenu check for null result from QPlatformMenu::menuItemForTag

QMenu needs to check result of QPlatformMenu::menuItemForTag to avoid
a crash dereferencing a null pointer.

Task-number: QTBUG-42327
Change-Id: Ie54a94caec7a5d756c459741df182fbe4e38bec0
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
This commit is contained in:
Dyami Caliri 2014-11-04 13:51:53 -08:00 committed by Morten Johan Sørvig
parent 063a544616
commit 8a9addf42e

View File

@ -3055,8 +3055,10 @@ void QMenu::actionEvent(QActionEvent *e)
delete menuItem;
} else if (e->type() == QEvent::ActionChanged) {
QPlatformMenuItem *menuItem = d->platformMenu->menuItemForTag(reinterpret_cast<quintptr>(e->action()));
copyActionToPlatformItem(e->action(), menuItem);
d->platformMenu->syncMenuItem(menuItem);
if (menuItem) {
copyActionToPlatformItem(e->action(), menuItem);
d->platformMenu->syncMenuItem(menuItem);
}
}
d->platformMenu->syncSeparatorsCollapsible(d->collapsibleSeparators);