aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickloader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickloader.cpp')
-rw-r--r--src/quick/items/qquickloader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 0de9d6c49a..f32f25a42f 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -112,6 +112,8 @@ void QQuickLoaderPrivate::clear()
q, SIGNAL(progressChanged()));
component->deleteLater();
component.setObject(nullptr, q);
+ } else if (component) {
+ component.setObject(nullptr, q);
}
source = QUrl();
@@ -437,7 +439,8 @@ void QQuickLoader::loadFromSource()
if (isComponentComplete()) {
QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
- d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this);
+ if (!d->component)
+ d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this);
d->load();
}
}
@@ -823,7 +826,8 @@ void QQuickLoader::componentComplete()
if (active()) {
if (d->loadingFromSource) {
QQmlComponent::CompilationMode mode = d->asynchronous ? QQmlComponent::Asynchronous : QQmlComponent::PreferSynchronous;
- d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this);
+ if (!d->component)
+ d->component.setObject(new QQmlComponent(qmlEngine(this), d->source, mode, this), this);
}
d->load();
}