[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:
parent
41b7b7f3e5
commit
645e1cf775
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue