Always call callCompleted in QQmlDataBlob::tryDone
authorAlbert Astals Cid <albert.astals@canonical.com>
Thu, 26 Sep 2013 08:56:03 +0000 (10:56 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 2 Oct 2013 14:07:33 +0000 (16:07 +0200)
commitb561a0a4ffa72fe1d43305dce90030d94316924b
tree1876d08a85da85191d11c69a8c18bdb035e0b1c9
parent10278163081c25f1b3e659b6769f0635776ab89a
Always call callCompleted in QQmlDataBlob::tryDone

We need this since it could happen that in QQmlComponentPrivate::loadUrl we did
  QQmlTypeData *data = QQmlEnginePrivate::get(engine)->typeLoader.getType(url, loaderMode);
and got a sync QQmlTypeData even if we asked for async, and thus the async loader was never notified
when it finished and we were never loaded.

Situation in which this can happen is:
 * ListView with an async Loader as delegate
 * Loader loads two items A and B, while A is a B
 * Item 0 of the ListView triggers an async loading of A that triggers the sync loading of B
 * Item 1 of the ListView triggers an async loading of B
 * Since B is already being loaded (though in sync), we just add ourselves to the people that want to be notified
 * sync loading of B is done and QQmlDataBlob::tryDone does not call the callbacks because it's sync
 * Item 1 is never finished loading

Change-Id: I52a0979a1d3cfcfe73a71196bf24f491d6cf8e9a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
14 files changed:
src/qml/qml/qqmltypeloader.cpp
tests/auto/qml/qml.pro
tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/SlowImport/plugin.h [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/SlowImport/qmldir [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/SlowImport/slow.h [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/data/GenericView.qml [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/data/NiceView.qml [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/data/test_load_complete.qml [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/qqmltypeloader.pro [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp [new file with mode: 0644]
tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.pro [new file with mode: 0644]