diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-24 01:23:56 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-24 01:23:56 (GMT) |
commit | d006d2c64c5f9ee53189c86c88512558dd9bca41 (patch) | |
tree | b6fb50d6cfa4cb6361398785621e47b5f027c0e7 | |
parent | 4a66f34750b6e56610bb3c55c6c3ca25a8795a36 (diff) | |
download | Qt-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.cpp | 10 |
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) |