diff options
-rw-r--r-- | src/qml/qml/qqmlincubator.cpp | 7 | ||||
-rw-r--r-- | tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp | 4 |
2 files changed, 3 insertions, 8 deletions
diff --git a/src/qml/qml/qqmlincubator.cpp b/src/qml/qml/qqmlincubator.cpp index 4cdeb19719..098a664ded 100644 --- a/src/qml/qml/qqmlincubator.cpp +++ b/src/qml/qml/qqmlincubator.cpp @@ -292,10 +292,7 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i) QQmlEngine *engine = compiledData->engine; QQmlEnginePrivate *enginePriv = QQmlEnginePrivate::get(engine); - bool guardOk = vmeGuard.isOK(); - vmeGuard.clear(); - - if (!guardOk) { + if (!vmeGuard.isOK()) { QQmlError error; error.setUrl(compiledData->url); error.setDescription(QQmlComponent::tr("Object destroyed during incubation")); @@ -305,6 +302,8 @@ void QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt &i) goto finishIncubate; } + vmeGuard.clear(); + if (progress == QQmlIncubatorPrivate::Execute) { enginePriv->referenceScarceResources(); QObject *tresult = 0; diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp index 0b9872f94c..75b10ed804 100644 --- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp +++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp @@ -171,10 +171,6 @@ void tst_qqmlincubator::objectDeleted() controller.incubateWhile(&b); } - // We have to cheat and manually remove it from the creator->allCreatedObjects - // otherwise we will do a double delete - QQmlIncubatorPrivate *incubatorPriv = QQmlIncubatorPrivate::get(&incubator); - incubatorPriv->creator->allCreatedObjects().pop(); delete SelfRegisteringType::me(); { |