From fe8ccf1d71282487a86b0792169e249121e8b38c Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 13 Jun 2011 13:56:55 +0200 Subject: [PATCH] guard mainItem, crash-- --- declarativeimports/core/dialog.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/declarativeimports/core/dialog.cpp b/declarativeimports/core/dialog.cpp index 64f430fa9..9df07362a 100644 --- a/declarativeimports/core/dialog.cpp +++ b/declarativeimports/core/dialog.cpp @@ -108,8 +108,10 @@ void DialogProxy::setMainItem(QGraphicsObject *mainItem) m_mainItem.data()->setParent(mainItem->parent()); } m_mainItem = mainItem; - mainItem->setParentItem(0); - mainItem->setParent(this); + if (mainItem) { + mainItem->setParentItem(0); + mainItem->setParent(this); + } //if this is called in Compenent.onCompleted we have to wait a loop the item is added to a scene QTimer::singleShot(0, this, SLOT(syncMainItem()));