diff -r cc75c76972ee -r c0432d11811c src/gui/widgets/qmenu.cpp --- a/src/gui/widgets/qmenu.cpp Wed Apr 21 12:15:23 2010 +0300 +++ b/src/gui/widgets/qmenu.cpp Wed Apr 21 20:15:53 2010 +0300 @@ -1406,12 +1406,14 @@ QMenu::~QMenu() { Q_D(QMenu); - QHash::iterator it = d->widgetItems.begin(); - for (; it != d->widgetItems.end(); ++it) { - if (QWidget *widget = it.value()) { - QWidgetAction *action = static_cast(it.key()); - action->releaseWidget(widget); - *it = 0; + if (!d->widgetItems.isEmpty()) { // avoid detach on shared null hash + QHash::iterator it = d->widgetItems.begin(); + for (; it != d->widgetItems.end(); ++it) { + if (QWidget *widget = it.value()) { + QWidgetAction *action = static_cast(it.key()); + action->releaseWidget(widget); + *it = 0; + } } } @@ -2811,7 +2813,9 @@ QAction *action = d->actionAt(e->pos()); if (!action) { - if (d->hasHadMouse) + if (d->hasHadMouse + && (!d->currentAction + || !(d->currentAction->menu() && d->currentAction->menu()->isVisible()))) d->setCurrentAction(0); return; } else if(e->buttons()) {