Fix QGtk3Menu::removeMenuItem()

The if-condition was broken, so items weren't removed from
the container as appropriate. Accessing such dangling items
caused a crash later on exit.

Task-number: QTBUG-54432
Task-number: QTBUG-54462
Change-Id: I98fd9f29a93d72e3e4a8f0fb6bac40ad4728ba6f
Reviewed-by: Heikki Halmet <heikki.halmet@qt.io>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
This commit is contained in:
J-P Nurmi 2016-08-08 14:21:14 +02:00
parent 815a41f714
commit 30eecdf6d8

View File

@ -371,7 +371,7 @@ void QGtk3Menu::insertMenuItem(QPlatformMenuItem *item, QPlatformMenuItem *befor
void QGtk3Menu::removeMenuItem(QPlatformMenuItem *item)
{
QGtk3MenuItem *gitem = static_cast<QGtk3MenuItem *>(item);
if (!gitem && !m_items.removeOne(gitem))
if (!gitem || !m_items.removeOne(gitem))
return;
GtkWidget *handle = gitem->handle();