diff options
Diffstat (limited to 'src/quick/items/qquickloader.cpp')
-rw-r--r-- | src/quick/items/qquickloader.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp index b5ae41daef..d0e29c204e 100644 --- a/src/quick/items/qquickloader.cpp +++ b/src/quick/items/qquickloader.cpp @@ -54,7 +54,7 @@ static const QQuickItemPrivate::ChangeTypes watchedChanges = QQuickItemPrivate::Geometry | QQuickItemPrivate::ImplicitWidth | QQuickItemPrivate::ImplicitHeight; QQuickLoaderPrivate::QQuickLoaderPrivate() - : item(nullptr), object(nullptr), component(nullptr), itemContext(nullptr), incubator(nullptr), updatingSize(false), + : item(nullptr), object(nullptr), itemContext(nullptr), incubator(nullptr), updatingSize(false), active(true), loadingFromSource(false), asynchronous(false) { } @@ -111,11 +111,10 @@ void QQuickLoaderPrivate::clear() QObject::disconnect(component, SIGNAL(progressChanged(qreal)), q, SIGNAL(progressChanged())); component->deleteLater(); - component = nullptr; + component.setObject(nullptr, q); } else if (component) { - component = nullptr; + component.setObject(nullptr, q); } - componentStrongReference.clear(); source = QUrl(); if (item) { @@ -441,7 +440,7 @@ void QQuickLoader::loadFromSource() if (isComponentComplete()) { QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous; if (!d->component) - d->component = new QQmlComponent(qmlEngine(this), d->source, mode, this); + d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); d->load(); } } @@ -484,11 +483,7 @@ void QQuickLoader::setSourceComponent(QQmlComponent *comp) d->clear(); - d->component = comp; - if (comp) { - if (QQmlData *ddata = QQmlData::get(comp)) - d->componentStrongReference = ddata->jsWrapper; - } + d->component.setObject(comp, this); d->loadingFromSource = false; if (d->active) @@ -832,7 +827,7 @@ void QQuickLoader::componentComplete() if (d->loadingFromSource) { QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous; if (!d->component) - d->component = new QQmlComponent(qmlEngine(this), d->source, mode, this); + d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this); } d->load(); } @@ -1007,7 +1002,7 @@ QUrl QQuickLoaderPrivate::resolveSourceUrl(QQmlV4Function *args) QV4::ReturnedValue QQuickLoaderPrivate::extractInitialPropertyValues(QQmlV4Function *args, QObject *loader, bool *error) { QV4::Scope scope(args->v4engine()); - QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); + QV4::ScopedValue valuemap(scope, QV4::Encode::undefined()); if (args->length() >= 2) { QV4::ScopedValue v(scope, (*args)[1]); if (!v->isObject() || v->as<QV4::ArrayObject>()) { |