aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-04-15 01:00:05 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-04-15 09:36:12 +0200
commit8bc3329e2cec4638fa9af274a40dda176bbb7352 (patch)
tree87ebd27e0f6dc305c78fddb956e65bd5922a078b
parent75998b22b0b216d925e93d2c0e205025c23b2522 (diff)
parent6dac2e7df7fbf0f29667bf92b4e72426db47dbe9 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.13v5.13.0-beta3
Conflicts: src/3rdparty/masm/assembler/LinkBuffer.h src/qmltest/doc/src/qtquicktest-index.qdoc tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp Change-Id: I7d83ad95cf489dda794dd7a0a33bad3ef3b05609
-rw-r--r--src/3rdparty/masm/assembler/LinkBuffer.h8
-rw-r--r--src/qml/compiler/qqmlpropertycachecreator_p.h40
-rw-r--r--src/qml/compiler/qv4compileddata.cpp6
-rw-r--r--src/qml/jsruntime/qv4engine.cpp4
-rw-r--r--src/qml/qml/qqmlvaluetype.cpp29
-rw-r--r--src/qmltest/doc/src/qtquicktest-index.qdoc8
-rw-r--r--src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc12
-rw-r--r--src/quick/items/qquickwindow.cpp12
-rw-r--r--tests/auto/qml/qqmllanguage/data/cyclicAlias.errors.txt1
-rw-r--r--tests/auto/qml/qqmllanguage/data/cyclicAlias.qml5
-rw-r--r--tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp1
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp23
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/BLACKLIST2
-rw-r--r--tools/qmlscene/main.cpp7
14 files changed, 122 insertions, 36 deletions
diff --git a/src/3rdparty/masm/assembler/LinkBuffer.h b/src/3rdparty/masm/assembler/LinkBuffer.h
index 4dfd051797..a1bb046d43 100644
--- a/src/3rdparty/masm/assembler/LinkBuffer.h
+++ b/src/3rdparty/masm/assembler/LinkBuffer.h
@@ -245,7 +245,7 @@ protected:
inline void linkCode(void* ownerUID, JITCompilationEffort);
- inline void performFinalization();
+ virtual void performFinalization();
#if DUMP_LINK_STATISTICS
static void dumpLinkStatistics(void* code, size_t initialSize, size_t finalSize);
@@ -344,7 +344,7 @@ inline void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::linkCode
}
template <typename MacroAssembler, template <typename T> class ExecutableOffsetCalculator>
-inline void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::performFinalization()
+void LinkBufferBase<MacroAssembler, ExecutableOffsetCalculator>::performFinalization()
{
// NOTE: This function is specialized in LinkBuffer<MacroAssemblerARMv7>
#ifndef NDEBUG
@@ -395,7 +395,7 @@ public:
linkCode(ownerUID, effort);
}
- inline void performFinalization();
+ virtual void performFinalization() override final;
inline void makeExecutable();
inline void linkCode(void* ownerUID, JITCompilationEffort);
@@ -420,7 +420,7 @@ private:
};
template <typename MacroAssembler>
-inline void BranchCompactingLinkBuffer<MacroAssembler>::performFinalization()
+void BranchCompactingLinkBuffer<MacroAssembler>::performFinalization()
{
#ifndef NDEBUG
ASSERT(!m_completed);
diff --git a/src/qml/compiler/qqmlpropertycachecreator_p.h b/src/qml/compiler/qqmlpropertycachecreator_p.h
index 6bee599c0a..074dc98648 100644
--- a/src/qml/compiler/qqmlpropertycachecreator_p.h
+++ b/src/qml/compiler/qqmlpropertycachecreator_p.h
@@ -692,11 +692,6 @@ inline QQmlCompileError QQmlPropertyCacheAliasCreator<ObjectContainer>::property
const CompiledObject &component, const QV4::CompiledData::Alias &alias, int *type, int *minorVersion,
QQmlPropertyData::Flags *propertyFlags)
{
- const int targetObjectIndex = objectForId(component, alias.targetObjectId);
- Q_ASSERT(targetObjectIndex >= 0);
-
- const CompiledObject &targetObject = *objectContainer->objectAt(targetObjectIndex);
-
*type = 0;
bool writable = false;
bool resettable = false;
@@ -704,11 +699,36 @@ inline QQmlCompileError QQmlPropertyCacheAliasCreator<ObjectContainer>::property
propertyFlags->isAlias = true;
if (alias.aliasToLocalAlias) {
- auto targetAlias = targetObject.aliasesBegin();
- for (uint i = 0; i < alias.localAliasIndex; ++i)
- ++targetAlias;
- return propertyDataForAlias(component, *targetAlias, type, minorVersion, propertyFlags);
- } else if (alias.encodedMetaPropertyIndex == -1) {
+ const QV4::CompiledData::Alias *lastAlias = &alias;
+ QVarLengthArray<const QV4::CompiledData::Alias *, 4> seenAliases({lastAlias});
+
+ do {
+ const CompiledObject *targetObject = objectContainer->objectAt(
+ objectForId(component, lastAlias->targetObjectId));
+ Q_ASSERT(targetObject);
+
+ auto nextAlias = targetObject->aliasesBegin();
+ for (uint i = 0; i < lastAlias->localAliasIndex; ++i)
+ ++nextAlias;
+
+ const QV4::CompiledData::Alias *targetAlias = &(*nextAlias);
+ if (seenAliases.contains(targetAlias)) {
+ return QQmlCompileError(targetAlias->location,
+ QQmlPropertyCacheCreatorBase::tr("Cyclic alias"));
+ }
+
+ seenAliases.append(targetAlias);
+ lastAlias = targetAlias;
+ } while (lastAlias->aliasToLocalAlias);
+
+ return propertyDataForAlias(component, *lastAlias, type, minorVersion, propertyFlags);
+ }
+
+ const int targetObjectIndex = objectForId(component, alias.targetObjectId);
+ Q_ASSERT(targetObjectIndex >= 0);
+ const CompiledObject &targetObject = *objectContainer->objectAt(targetObjectIndex);
+
+ if (alias.encodedMetaPropertyIndex == -1) {
Q_ASSERT(alias.flags & QV4::CompiledData::Alias::AliasPointsToPointerObject);
auto *typeRef = objectContainer->resolvedType(targetObject.inheritedTypeNameIndex);
if (!typeRef) {
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index dc5466371d..e6d079fe36 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -471,8 +471,10 @@ Heap::Module *CompilationUnit::instantiate(ExecutionEngine *engine)
ScopedString importName(scope);
const uint importCount = data->importEntryTableSize;
- imports = new const Value *[importCount];
- memset(imports, 0, importCount * sizeof(Value *));
+ if (importCount > 0) {
+ imports = new const Value *[importCount];
+ memset(imports, 0, importCount * sizeof(Value *));
+ }
for (uint i = 0; i < importCount; ++i) {
const CompiledData::ImportEntry &entry = data->importEntryTable()[i];
auto dependentModuleUnit = engine->loadModule(QUrl(stringAt(entry.moduleRequest)), this);
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index f506e4015e..4c5e124cb0 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1547,6 +1547,10 @@ QV4::ReturnedValue QV4::ExecutionEngine::fromVariant(const QVariant &variant)
case QMetaType::QLocale:
return QQmlLocale::wrap(this, *reinterpret_cast<const QLocale*>(ptr));
#endif
+ case QMetaType::QPixmap:
+ case QMetaType::QImage:
+ // Scarce value types
+ return QV4::Encode(newVariantObject(variant));
default:
break;
}
diff --git a/src/qml/qml/qqmlvaluetype.cpp b/src/qml/qml/qqmlvaluetype.cpp
index e92488f9f6..6fd0f0d37c 100644
--- a/src/qml/qml/qqmlvaluetype.cpp
+++ b/src/qml/qml/qqmlvaluetype.cpp
@@ -81,19 +81,26 @@ QQmlValueTypeFactoryImpl::~QQmlValueTypeFactoryImpl()
bool QQmlValueTypeFactoryImpl::isValueType(int idx)
{
- if (idx >= (int)QVariant::UserType) {
- return (valueType(idx) != nullptr);
- } else if (idx >= 0
- && idx != QVariant::StringList
- && idx != QMetaType::QObjectStar
- && idx != QMetaType::VoidStar
- && idx != QMetaType::Nullptr
- && idx != QMetaType::QVariant
- && idx != QMetaType::QLocale) {
+ if (idx >= QMetaType::User)
+ return valueType(idx) != nullptr;
+
+ if (idx < 0)
+ return false;
+
+ // Qt internal types
+ switch (idx) {
+ case QMetaType::QStringList:
+ case QMetaType::QObjectStar:
+ case QMetaType::VoidStar:
+ case QMetaType::Nullptr:
+ case QMetaType::QVariant:
+ case QMetaType::QLocale:
+ case QMetaType::QImage: // scarce type, keep as QVariant
+ case QMetaType::QPixmap: // scarce type, keep as QVariant
+ return false;
+ default:
return true;
}
-
- return false;
}
const QMetaObject *QQmlValueTypeFactoryImpl::metaObjectForMetaType(int t)
diff --git a/src/qmltest/doc/src/qtquicktest-index.qdoc b/src/qmltest/doc/src/qtquicktest-index.qdoc
index 668d6c1417..a7a840f2b3 100644
--- a/src/qmltest/doc/src/qtquicktest-index.qdoc
+++ b/src/qmltest/doc/src/qtquicktest-index.qdoc
@@ -164,6 +164,10 @@
and \l {QQmlFileSelector::setExtraSelectors}{extra file selectors}
will have been set on the engine by this point.
+ This function is called once for each QML test file,
+ so any arguments are unique to that test. For example, this
+ means that each QML test file will have its own QML engine.
+
This function can be used to \l {Choosing the Correct Integration
Method Between C++ and QML}{register QML types} and
\l {QQmlEngine::addImportPath()}{add import paths},
@@ -176,10 +180,6 @@
\li Qt 5.12
\endtable
- Each function will be called once for each \c {tst_*.qml} file, so any
- arguments are unique to that test. For example, this means that each QML
- test file will have its own QML engine.
-
The following example demonstrates how the macro can be used to set context
properties on the QML engine:
diff --git a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
index 4c94259139..9383c78a42 100644
--- a/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
+++ b/src/quick/doc/src/concepts/visualcanvas/scenegraph.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
@@ -269,7 +269,7 @@ animations, process events, etc.
\endlist
The threaded renderer is currently used by default on Windows with
-opengl32.dll, Linux with non-Mesa based drivers, \macos, mobile
+opengl32.dll, Linux with non-Mesa based drivers, mobile
platforms, and Embedded Linux with EGLFS but this is subject to
change. It is possible to force use of the threaded renderer by
setting \c {QSG_RENDER_LOOP=threaded} in the environment.
@@ -277,13 +277,19 @@ setting \c {QSG_RENDER_LOOP=threaded} in the environment.
\section2 Non-threaded Render Loops ("basic" and "windows")
The non-threaded render loop is currently used by default on Windows
-with ANGLE or a non-default opengl32 implementation and Linux with
+with ANGLE or a non-default opengl32 implementation, \macos, and Linux with
Mesa drivers. For the latter this is mostly a precautionary measure,
as not all combinations of OpenGL drivers and windowing systems have
been tested. At the same time implementations like ANGLE or Mesa
llvmpipe are not able to function properly with threaded rendering at
all so not using threaded rendering is essential for these.
+On macOS, the threaded render loop is not supported when building
+with XCode 10 (10.14 SDK) or later, since this opts in to layer-backed
+views on macOS 10.14. You can build with Xcode 9 (10.13 SDK) to opt
+out of layer-backing, in which case the threaded render loop is
+available and used by default.
+
By default \c windows is used for non-threaded rendering on Windows
with ANGLE, while \c basic is used for all other platforms when
non-threaded rendering is needed.
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 88d419e2b3..9d0f4a6893 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -4892,10 +4892,18 @@ void QQuickWindow::scheduleRenderJob(QRunnable *job, RenderStage stage)
} else if (stage == AfterSwapStage) {
d->afterSwapJobs << job;
} else if (stage == NoStage) {
- if (isExposed())
+ if (d->renderControl && openglContext()
+#if QT_CONFIG(opengl)
+ && openglContext()->thread() == QThread::currentThread()
+#endif
+ ) {
+ job->run();
+ delete job;
+ } else if (isExposed()) {
d->windowManager->postJob(this, job);
- else
+ } else {
delete job;
+ }
}
d->renderJobMutex.unlock();
}
diff --git a/tests/auto/qml/qqmllanguage/data/cyclicAlias.errors.txt b/tests/auto/qml/qqmllanguage/data/cyclicAlias.errors.txt
new file mode 100644
index 0000000000..46951ef69f
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/cyclicAlias.errors.txt
@@ -0,0 +1 @@
+4:5:Cyclic alias
diff --git a/tests/auto/qml/qqmllanguage/data/cyclicAlias.qml b/tests/auto/qml/qqmllanguage/data/cyclicAlias.qml
new file mode 100644
index 0000000000..23129e210d
--- /dev/null
+++ b/tests/auto/qml/qqmllanguage/data/cyclicAlias.qml
@@ -0,0 +1,5 @@
+import QtQml 2.2
+QtObject {
+ id: o
+ property alias t: o.t
+}
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
index 22ea3a89c3..89c1d05905 100644
--- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
+++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp
@@ -614,6 +614,7 @@ void tst_qqmllanguage::errors_data()
QTest::newRow("badCompositeRegistration.2") << "badCompositeRegistration.2.qml" << "badCompositeRegistration.2.errors.txt" << false;
QTest::newRow("assignComponentToWrongType") << "assignComponentToWrongType.qml" << "assignComponentToWrongType.errors.txt" << false;
+ QTest::newRow("cyclicAlias") << "cyclicAlias.qml" << "cyclicAlias.errors.txt" << false;
}
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index 6ccfc77c25..15bd031ce3 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -33,6 +33,8 @@
#include <QJSValueIterator>
#include <private/qquickvaluetypes_p.h>
#include <private/qqmlglobal_p.h>
+#include <private/qv4engine_p.h>
+#include <private/qv4variantobject_p.h>
#include "../../shared/util.h"
#include "testtypes.h"
@@ -94,6 +96,7 @@ private slots:
void toStringConversion();
void enumerableProperties();
void enumProperties();
+ void scarceTypes();
private:
QQmlEngine engine;
@@ -1809,6 +1812,26 @@ void tst_qqmlvaluetypes::enumProperties()
QCOMPARE(enumValue.toInt(), int(g.enumProperty()));
}
+void tst_qqmlvaluetypes::scarceTypes()
+{
+ // These should not be treated as value types because we want the scarce resource
+ // mechanism to clear them when going out of scope. The scarce resource mechanism
+ // only works on QV4::VariantObject as that has an additional level of redirection.
+ QVERIFY(!QQmlValueTypeFactory::isValueType(qMetaTypeId<QImage>()));
+ QVERIFY(!QQmlValueTypeFactory::isValueType(qMetaTypeId<QPixmap>()));
+
+ QV4::ExecutionEngine engine;
+ QV4::Scope scope(&engine);
+
+ QImage img(20, 20, QImage::Format_ARGB32);
+ QV4::ScopedObject imgValue(scope, engine.fromVariant(QVariant::fromValue(img)));
+ QCOMPARE(QByteArray(imgValue->vtable()->className), QByteArray("VariantObject"));
+
+ QPixmap pixmap;
+ QV4::ScopedObject pixmapValue(scope, engine.fromVariant(QVariant::fromValue(img)));
+ QCOMPARE(QByteArray(pixmapValue->vtable()->className), QByteArray("VariantObject"));
+}
+
QTEST_MAIN(tst_qqmlvaluetypes)
diff --git a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
index de939b5273..6af00ab76f 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
+++ b/tests/auto/quick/qquickmultipointtoucharea/BLACKLIST
@@ -3,8 +3,10 @@ ubuntu-16.04
ubuntu-18.04
opensuse-42.3
opensuse-leap
+sles
[nested]
ubuntu-16.04
ubuntu-18.04
opensuse-42.3
opensuse-leap
+sles
diff --git a/tools/qmlscene/main.cpp b/tools/qmlscene/main.cpp
index c6c6ed1c4a..867267c821 100644
--- a/tools/qmlscene/main.cpp
+++ b/tools/qmlscene/main.cpp
@@ -42,6 +42,7 @@
#include <QtQml/qqmlengine.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlcontext.h>
+#include <QtQml/qqmlfileselector.h>
#include <QtQuick/qquickitem.h>
#include <QtQuick/qquickview.h>
@@ -361,6 +362,7 @@ static void usage()
#endif
puts(" --textrendertype [qt|native].......Select the default render type for text-like elements.");
puts(" -I <path> ........................ Add <path> to the list of import paths");
+ puts(" -S <selector> .....................Add <selector> to the list of QQmlFileSelector selectors");
puts(" -P <path> ........................ Add <path> to the list of plugin paths");
puts(" -translation <translationfile> ... Set the language to run in");
@@ -457,6 +459,7 @@ int main(int argc, char ** argv)
Options options;
QStringList imports;
+ QStringList customSelectors;
QStringList pluginPaths;
// Parse arguments for application attributes to be applied before Q[Gui]Application creation.
@@ -529,6 +532,8 @@ int main(int argc, char ** argv)
options.verbose = true;
else if (lowerArgument == QLatin1String("-i") && i + 1 < size)
imports.append(arguments.at(++i));
+ else if (lowerArgument == QLatin1String("-s") && i + 1 < size)
+ customSelectors.append(arguments.at(++i));
else if (lowerArgument == QLatin1String("-p") && i + 1 < size)
pluginPaths.append(arguments.at(++i));
else if (lowerArgument == QLatin1String("--apptype"))
@@ -584,6 +589,8 @@ int main(int argc, char ** argv)
// TODO: as soon as the engine construction completes, the debug service is
// listening for connections. But actually we aren't ready to debug anything.
QQmlEngine engine;
+ QQmlFileSelector* selector = new QQmlFileSelector(&engine, &engine);
+ selector->setExtraSelectors(customSelectors);
QPointer<QQmlComponent> component = new QQmlComponent(&engine);
for (int i = 0; i < imports.size(); ++i)
engine.addImportPath(imports.at(i));