summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets/qmenu.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-04-12 15:39:28 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-04-12 15:39:28 (GMT)
commit3723f30a91eda1c1b247598913cfc02b001a02c9 (patch)
tree234241d0d6dbbf29857c4e66d2723f77239f31ee /src/gui/widgets/qmenu.cpp
parent6f736694461edc25b6e757f40ab9cad6a9207ad4 (diff)
parent957f36cb498657f94f1b5b92f52713254ff8c051 (diff)
downloadQt-3723f30a91eda1c1b247598913cfc02b001a02c9.zip
Qt-3723f30a91eda1c1b247598913cfc02b001a02c9.tar.gz
Qt-3723f30a91eda1c1b247598913cfc02b001a02c9.tar.bz2
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: qmake/generators/symbian/symmake.cpp src/gui/image/qimage.cpp src/openvg/qwindowsurface_vgegl.cpp
Diffstat (limited to 'src/gui/widgets/qmenu.cpp')
-rw-r--r--src/gui/widgets/qmenu.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 404d46e..9e190b7 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1398,12 +1398,14 @@ QMenu::QMenu(QMenuPrivate &dd, QWidget *parent)
QMenu::~QMenu()
{
Q_D(QMenu);
- QHash<QAction *, QWidget *>::iterator it = d->widgetItems.begin();
- for (; it != d->widgetItems.end(); ++it) {
- if (QWidget *widget = it.value()) {
- QWidgetAction *action = static_cast<QWidgetAction *>(it.key());
- action->releaseWidget(widget);
- *it = 0;
+ if (!d->widgetItems.isEmpty()) { // avoid detach on shared null hash
+ QHash<QAction *, QWidget *>::iterator it = d->widgetItems.begin();
+ for (; it != d->widgetItems.end(); ++it) {
+ if (QWidget *widget = it.value()) {
+ QWidgetAction *action = static_cast<QWidgetAction *>(it.key());
+ action->releaseWidget(widget);
+ *it = 0;
+ }
}
}