aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlbert Astals Cid <albert.astals@canonical.com>2013-10-08 10:51:03 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-16 09:09:15 +0200
commit54b73b8ab53ee41d9c8a855aa9a3da425e0a3f8f (patch)
tree81d3b27dc0e0d72e277cec110603b90b6d2651d9 /src
parent29beac9aa1daf9a044dc62e567283779e68b3724 (diff)
Fix infinite loop in QQmlIncubator::forceCompletion
Without this change I'm getting this backtrace 3 0x4025b9f2 in QQmlIncubatorPrivate::incubate (this=0x18daa78, i=...) at qml/qqmlincubator.cpp:273 4 0x4025c1c2 in QQmlIncubator::forceCompletion (this=0x1527360) at qml/qqmlincubator.cpp:592 5 0x404e1626 in QQuickVisualDataModelPrivate::object (this=this@entry=0x13909f8, group=QQuickListCompositor::Default, index=index@entry=1, asynchronous=asynchronous@entry=false) at items/qquickvisualdatamodel.cpp:900 6 0x404e1f7e in QQuickVisualDataModel::item (this=<optimized out>, index=1, asynchronous=<optimized out>) at items/qquickvisualdatamodel.cpp:968 Note: This is with patched 5.0.x, change QQuickVisualDataModel to QQmlDelegateModel for >= 5.1 and line numbers may be a bit off What is happening: QQmlIncubator::forceCompletion is doing while (Loading == status()) { while (Loading == status() && !d->waitingFor.isEmpty()) static_cast<QQmlIncubatorPrivate *>(d->waitingFor.first())->incubate(i); if (Loading == status()) d->incubate(i); } Calling QQmlIncubatorPrivate::incubate on the first item of d->waitingFor Then, that item is getting to QQmlIncubatorPrivate::incubate and happens that progress is QQmlIncubatorPrivate::Completed and waitingFor is not empty, so the only thing that QQmlIncubatorPrivate::incubate ends up doing is calling a few calls over vmeGuard and returning, that way the inner waitingFor items never finishe incubating and you end up in an inifite loop inside while (Loading == status() && !d->waitingFor.isEmpty()) static_cast<QQmlIncubatorPrivate *>(d->waitingFor.first())->incubate(i); This patch basically replaces this loop with a loop that does while (QQmlIncubator::Loading == status && !waitingFor.isEmpty()) static_cast<QQmlIncubatorPrivate *>(waitingFor.first())->forceCompletion(i); This way we make sure we incubate the waitingFor items of our waitingFor items Change-Id: I4298efc7ba9d8af624bb138e64b92a40ed4c4dc9 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src')
-rw-r--r--src/qml/qml/qqmlincubator.cpp17
-rw-r--r--src/qml/qml/qqmlincubator_p.h1
2 files changed, 12 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp
index 71adf44e6b..ade4634c2d 100644
--- a/src/qml/qml/qqmlincubator.cpp
+++ b/src/qml/qml/qqmlincubator.cpp
@@ -253,6 +253,16 @@ void QQmlIncubationController::incubatingObjectCountChanged(int incubatingObject
Q_UNUSED(incubatingObjectCount);
}
+void QQmlIncubatorPrivate::forceCompletion(QQmlVME::Interrupt &i)
+{
+ while (QQmlIncubator::Loading == status) {
+ while (QQmlIncubator::Loading == status && !waitingFor.isEmpty())
+ static_cast<QQmlIncubatorPrivate *>(waitingFor.first())->forceCompletion(i);
+ if (QQmlIncubator::Loading == status)
+ incubate(i);
+ }
+}
+
void QQmlIncubatorPrivate::incubate(QQmlVME::Interrupt &i)
{
if (!compiledData)
@@ -587,12 +597,7 @@ returns, the incubator will not be in the Loading state.
void QQmlIncubator::forceCompletion()
{
QQmlVME::Interrupt i;
- while (Loading == status()) {
- while (Loading == status() && !d->waitingFor.isEmpty())
- static_cast<QQmlIncubatorPrivate *>(d->waitingFor.first())->incubate(i);
- if (Loading == status())
- d->incubate(i);
- }
+ d->forceCompletion(i);
}
/*!
diff --git a/src/qml/qml/qqmlincubator_p.h b/src/qml/qml/qqmlincubator_p.h
index 58e9c93f15..e7246ce3b2 100644
--- a/src/qml/qml/qqmlincubator_p.h
+++ b/src/qml/qml/qqmlincubator_p.h
@@ -99,6 +99,7 @@ public:
void clear();
+ void forceCompletion(QQmlVME::Interrupt &i);
void incubate(QQmlVME::Interrupt &i);
};