summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-05-24 01:23:56 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-05-24 01:23:56 (GMT)
commitd006d2c64c5f9ee53189c86c88512558dd9bca41 (patch)
treeb6fb50d6cfa4cb6361398785621e47b5f027c0e7
parent4a66f34750b6e56610bb3c55c6c3ca25a8795a36 (diff)
downloadQt-d006d2c64c5f9ee53189c86c88512558dd9bca41.zip
Qt-d006d2c64c5f9ee53189c86c88512558dd9bca41.tar.gz
Qt-d006d2c64c5f9ee53189c86c88512558dd9bca41.tar.bz2
Component::createObject() don't attempt to set parent of null object
Don't try to set graphics item parent on an object that is not a QGraphicsItem
-rw-r--r--src/declarative/qml/qdeclarativecomponent.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp
index 3f11425..3b782e7 100644
--- a/src/declarative/qml/qdeclarativecomponent.cpp
+++ b/src/declarative/qml/qdeclarativecomponent.cpp
@@ -576,10 +576,12 @@ QScriptValue QDeclarativeComponent::createObject(QObject* parent)
bool needParent = (gobj != 0);
if(parent){
ret->setParent(parent);
- QGraphicsObject* gparent = qobject_cast<QGraphicsObject*>(parent);
- if(gparent){
- gobj->setParentItem(gparent);
- needParent = false;
+ if (gobj) {
+ QGraphicsObject* gparent = qobject_cast<QGraphicsObject*>(parent);
+ if(gparent){
+ gobj->setParentItem(gparent);
+ needParent = false;
+ }
}
}
if(needParent)