From 0cb67317e8c22282901a73568cf903ea1bec725d Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 27 Aug 2009 10:08:10 +1000 Subject: Fix potential crash on deletion. If an item's parent is being destructed, no need to update anchors. --- src/declarative/fx/qfxitem.cpp | 11 ++++++----- 1 file 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; } -- cgit v0.12