diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2013-09-26 10:56:03 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-02 16:07:33 +0200 |
commit | b561a0a4ffa72fe1d43305dce90030d94316924b (patch) | |
tree | 1876d08a85da85191d11c69a8c18bdb035e0b1c9 /tests/auto/qml/qqmltypeloader/SlowImport | |
parent | 10278163081c25f1b3e659b6769f0635776ab89a (diff) |
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>
Diffstat (limited to 'tests/auto/qml/qqmltypeloader/SlowImport')
-rw-r--r-- | tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro | 12 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp | 51 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/SlowImport/plugin.h | 57 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/SlowImport/qmldir | 2 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp | 50 | ||||
-rw-r--r-- | tests/auto/qml/qqmltypeloader/SlowImport/slow.h | 53 |
6 files changed, 225 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro b/tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro new file mode 100644 index 0000000000..e76dbd1237 --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/SlowImport/Slow.pro @@ -0,0 +1,12 @@ +TEMPLATE = lib +TARGET = Slow +INCLUDEPATH += . +QT += quick qml + +# Input +HEADERS += plugin.h slow.h +SOURCES += plugin.cpp slow.cpp + +DESTDIR = ../Slow +IMPORT_FILES = qmldir +include (../../../shared/imports.pri) diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp new file mode 100644 index 0000000000..f184dff165 --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "plugin.h" + +#include "slow.h" +#include <qqml.h> + +void SlowPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(uri == QLatin1String("Slow")); + qmlRegisterType<SlowStuff>(uri, 1, 0, "SlowStuff"); +} diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h new file mode 100644 index 0000000000..ed467a848c --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/SlowImport/plugin.h @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SLOW_PLUGIN_H +#define SLOW_PLUGIN_H + +#include <QtQml/QQmlEngine> +#include <QtQml/QQmlExtensionPlugin> + +class SlowPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri); +}; + +#endif diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/qmldir b/tests/auto/qml/qqmltypeloader/SlowImport/qmldir new file mode 100644 index 0000000000..f07f777b8f --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/SlowImport/qmldir @@ -0,0 +1,2 @@ +module Slow +plugin Slow diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp b/tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp new file mode 100644 index 0000000000..080293bbf1 --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/SlowImport/slow.cpp @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "slow.h" + +#include <QThread> + +SlowStuff::SlowStuff() +{ + QThread::usleep(500000); +} + diff --git a/tests/auto/qml/qqmltypeloader/SlowImport/slow.h b/tests/auto/qml/qqmltypeloader/SlowImport/slow.h new file mode 100644 index 0000000000..6f7a64573d --- /dev/null +++ b/tests/auto/qml/qqmltypeloader/SlowImport/slow.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Canonical Limited and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef SLOWSTUFF_H +#define SLOWSTUFF_H + +#include <QObject> + +class SlowStuff : public QObject +{ +public: + SlowStuff(); +}; + +#endif
\ No newline at end of file |