Android: Make platform menu more robust
Don't crash and lock up the whole device when people try to remove menu items that don't exist. Task-number: QTBUG-34246 Change-Id: I4396d252c5af93e021c9e218dbab7c0e7f190d9d Reviewed-by: BogDan Vatra <bogdan@kde.org>
This commit is contained in:
parent
a83983d861
commit
bd3f3f31bf
@ -67,9 +67,11 @@ void QAndroidPlatformMenu::insertMenuItem(QPlatformMenuItem *menuItem, QPlatform
|
|||||||
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
void QAndroidPlatformMenu::removeMenuItem(QPlatformMenuItem *menuItem)
|
||||||
{
|
{
|
||||||
QMutexLocker lock(&m_menuItemsMutex);
|
QMutexLocker lock(&m_menuItemsMutex);
|
||||||
m_menuItems.erase(qFind(m_menuItems.begin(),
|
PlatformMenuItemsType::iterator it = qFind(m_menuItems.begin(),
|
||||||
m_menuItems.end(),
|
m_menuItems.end(),
|
||||||
static_cast<QAndroidPlatformMenuItem *>(menuItem)));
|
static_cast<QAndroidPlatformMenuItem *>(menuItem));
|
||||||
|
if (it != m_menuItems.end())
|
||||||
|
m_menuItems.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
void QAndroidPlatformMenu::syncMenuItem(QPlatformMenuItem *menuItem)
|
||||||
|
Loading…
Reference in New Issue
Block a user