From 09af2cf9310c4804566288605bc7b4c075e65915 Mon Sep 17 00:00:00 2001
From: Thomas Hartmann <Thomas.Hartmann@nokia.com>
Date: Wed, 22 Sep 2010 16:06:14 +0200
Subject: [PATCH] QmlDesigner: crashfix

Check if object is not 0 and we are not called back from the
destructor.
---
 .../designercore/instances/objectnodeinstance.cpp            | 4 +++-
 .../designercore/instances/qmlgraphicsitemnodeinstance.cpp   | 5 ++++-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp
index 8c215c81c86..e282c27d897 100644
--- a/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/objectnodeinstance.cpp
@@ -782,7 +782,9 @@ QObject* ObjectNodeInstance::createObject(const NodeMetaInfo &metaInfo, QDeclara
 
 QObject *ObjectNodeInstance::object() const
 {
-    return m_object.data();
+        if (!m_object.isNull() && !QObjectPrivate::get(m_object.data())->wasDeleted)
+            return m_object.data();
+        return 0;
 }
 
 bool ObjectNodeInstance::hasContent() const
diff --git a/src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.cpp b/src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.cpp
index d6e2d868da9..a5fbac695d2 100644
--- a/src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.cpp
+++ b/src/plugins/qmldesigner/designercore/instances/qmlgraphicsitemnodeinstance.cpp
@@ -178,7 +178,10 @@ QRectF QmlGraphicsItemNodeInstance::boundingRect() const
         }
     }
 
-    return qmlGraphicsItem()->boundingRect();
+    if (qmlGraphicsItem())
+        return qmlGraphicsItem()->boundingRect();
+
+    return QRectF();
 }
 
 //QVariant anchorLineFor(QDeclarativeItem *item, const AnchorLine &anchorLine)
-- 
GitLab