aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Miklas <marcin.miklas@teleca.com>2010-09-21 11:32:45 +0200
committerSergiy Dubovik <sergiy.dubovik@nokia.com>2010-10-05 13:12:58 +0300
commit6667e26ee8c73fa611dae9097f556b08492cfdb9 (patch)
tree5ac4221111f3094cf3af7fee235253436295bc5b
parent83a2d00f142345e18d9a05ad858a65e823a4998c (diff)
Changes: Do not reload child items styles with new parent is NULL.
RevBy: Stanislav, Sergiy, Robin Details: Crashes were observed in 0.20.41-1 when MApplicationPage with MList inside was destroyed. Stack traces show that it is caused by calling MWidgetViewPrivate::reloadChildItemStyles which in turn called MListView::applyStyle() when QGraphicsScene::removeItem sets parent of removed item to 0. I updated MWidgetView::notifyItemChange to not call reloadChildItemStyles when new parent of item is NULL. Although from version 0.20.42-1 this crash doesn't reproduce, I think that we should add this additional check. It fixes crash when applied to 0.20.41-1 version and should speed up things a little in current version. Additionally, bugs which were fixed with introduction of reloadChildItemStyles doesn't reappear after adding this additional check. So it shouldn't brake anything.
-rw-r--r--src/corelib/widgets/core/mwidgetview.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/widgets/core/mwidgetview.cpp b/src/corelib/widgets/core/mwidgetview.cpp
index 7bc343f4..772f01b0 100644
--- a/src/corelib/widgets/core/mwidgetview.cpp
+++ b/src/corelib/widgets/core/mwidgetview.cpp
@@ -414,7 +414,6 @@ void MWidgetViewPrivate::reloadChildItemsStyles(QGraphicsItem* item)
void MWidgetView::notifyItemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
{
Q_D(MWidgetView);
- Q_UNUSED(value);
if (change == QGraphicsItem::ItemEnabledHasChanged) {
d->setEnabled(d->controller->isEnabled());
} else if (change == QGraphicsItem::ItemSelectedHasChanged) {
@@ -429,8 +428,10 @@ void MWidgetView::notifyItemChange(QGraphicsItem::GraphicsItemChange change, con
}
style().setParent(parent);
- d->reloadChildItemsStyles(d->controller);
- applyStyle();
+ if (value.value<QGraphicsItem*>() != NULL) {
+ d->reloadChildItemsStyles(d->controller);
+ applyStyle();
+ }
}
}
void MWidgetView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)