QMenu: Use Qt::QueuedConnection when connecting to native menu.

This fix allows to catch exeptions thrown in slots connected to
QAction::triggered() signal via QApplication::notify().

Task-number: QTBUG-15197
Change-Id: I6f3e51ec39139ffb0a5f3a31b79f839c18089b26
Reviewed-by: Andy Shaw <andy.shaw@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
Ivan Komissarov 2014-05-01 21:26:05 +04:00 committed by The Qt Project
parent 697cb33896
commit 7db24dd864

View File

@ -187,8 +187,8 @@ void QMenuPrivate::syncPlatformMenu()
QPlatformMenuItem *menuItem = platformMenu->createMenuItem();
QAction *action = it.previous();
menuItem->setTag(reinterpret_cast<quintptr>(action));
QObject::connect(menuItem, SIGNAL(activated()), action, SLOT(trigger()));
QObject::connect(menuItem, SIGNAL(hovered()), action, SIGNAL(hovered()));
QObject::connect(menuItem, SIGNAL(activated()), action, SLOT(trigger()), Qt::QueuedConnection);
QObject::connect(menuItem, SIGNAL(hovered()), action, SIGNAL(hovered()), Qt::QueuedConnection);
copyActionToPlatformItem(action, menuItem);
platformMenu->insertMenuItem(menuItem, beforeItem);
beforeItem = menuItem;