summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-08-27 00:08:10 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-08-27 00:08:10 (GMT)
commit0cb67317e8c22282901a73568cf903ea1bec725d (patch)
treeb87c53cb43706c75e3a728dd7a7ba175c974ff03 /src/declarative
parent3d33fb250c4d23b746124b8d1f1a974cdacb48e6 (diff)
downloadQt-0cb67317e8c22282901a73568cf903ea1bec725d.zip
Qt-0cb67317e8c22282901a73568cf903ea1bec725d.tar.gz
Qt-0cb67317e8c22282901a73568cf903ea1bec725d.tar.bz2
Fix potential crash on deletion.
If an item's parent is being destructed, no need to update anchors.
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/fx/qfxitem.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index 666369a..c3c6bc4 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -1164,11 +1164,12 @@ QFxItem::~QFxItem()
QFxAnchors *anchor = d->dependantAnchors.at(ii);
anchor->d_func()->clearItem(this);
}
- for (int ii = 0; ii < d->dependantAnchors.count(); ++ii) {
- QFxAnchors *anchor = d->dependantAnchors.at(ii);
- if (anchor->d_func()->item && anchor->d_func()->item->parentItem() != this) //child will be deleted anyway
- anchor->d_func()->updateOnComplete();
- }
+ if (!d->parent || (parentItem() && !parentItem()->QGraphicsItem::d_ptr->inDestructor))
+ for (int ii = 0; ii < d->dependantAnchors.count(); ++ii) {
+ QFxAnchors *anchor = d->dependantAnchors.at(ii);
+ if (anchor->d_func()->item && anchor->d_func()->item->parentItem() != this) //child will be deleted anyway
+ anchor->d_func()->updateOnComplete();
+ }
delete d->_anchorLines; d->_anchorLines = 0;
delete d->_anchors; d->_anchors = 0;
}