[scripting] Reparent the created QML object

According to the documentation the ownership of a QObject created by
QQmlComponent::create is transferred to the caller.

This fixes a crash on KWin tear down.

REVIEW: 118345
This commit is contained in:
Martin Gräßlin 2014-05-27 11:05:01 +02:00
parent 41b7b7f3e5
commit 645e1cf775

View file

@ -556,7 +556,9 @@ void KWin::DeclarativeScript::createComponent()
if (m_component->isError()) {
qDebug() << "Component failed to load: " << m_component->errors();
} else {
m_component->create(m_context);
if (QObject *object = m_component->create(m_context)) {
object->setParent(this);
}
}
setRunning(true);
}