aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2017-04-22 11:51:09 +0200
committerLars Knoll <lars.knoll@qt.io>2017-04-22 12:28:37 +0200
commit7d1b3b23897359b4ba51747229261867993536a8 (patch)
treee6fd5a89383535a8cf9b65d07403a2950d839bcd
parentc50113aaf4515c172a1dd2eb30532de088307d78 (diff)
parent93bc4113f06dce4c942374d765bef20054cd1f94 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
-rw-r--r--src/particles/qquickimageparticle.cpp7
-rw-r--r--src/plugins/qmltooling/qmltooling.pro29
-rw-r--r--src/qml/compiler/qv4ssa.cpp2
-rw-r--r--src/qml/jit/qv4isel_masm.cpp1
-rw-r--r--src/qml/jit/qv4regalloc.cpp2
-rw-r--r--src/qml/jsruntime/qv4engine.cpp2
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp2
-rw-r--r--src/qml/jsruntime/qv4value.cpp3
-rw-r--r--src/qml/memory/qv4mm.cpp7
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp4
-rw-r--r--src/quick/items/qquickmultipointtoucharea.cpp2
-rw-r--r--src/quick/items/qquicktextinput.cpp1
-rw-r--r--src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp1
-rw-r--r--src/quick/scenegraph/util/qsgshadersourcebuilder.cpp4
-rw-r--r--tests/auto/qml/qqmlengine/data/testGCCorruption.qml29
-rw-r--r--tests/auto/qml/qqmlengine/tst_qqmlengine.cpp11
17 files changed, 88 insertions, 21 deletions
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index fde491b1ef..e388b52db3 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -1323,6 +1323,7 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
getState<ImageMaterialData>(m_material)->animSheetSize = QSizeF(image.size());
if (m_spriteEngine)
m_spriteEngine->setCount(m_count);
+ Q_FALLTHROUGH();
case Tabled:
if (!m_material)
m_material = TabledMaterial::createMaterial();
@@ -1355,12 +1356,15 @@ void QQuickImageParticle::finishBuildParticleNodes(QSGNode** node)
getState<ImageMaterialData>(m_material)->colorTable = QSGPlainTexture::fromImage(colortable);
fillUniformArrayFromImage(getState<ImageMaterialData>(m_material)->sizeTable, sizetable, UNIFORM_ARRAY_SIZE);
fillUniformArrayFromImage(getState<ImageMaterialData>(m_material)->opacityTable, opacitytable, UNIFORM_ARRAY_SIZE);
+ Q_FALLTHROUGH();
case Deformable:
if (!m_material)
m_material = DeformableMaterial::createMaterial();
+ Q_FALLTHROUGH();
case Colored:
if (!m_material)
m_material = ColoredMaterial::createMaterial();
+ Q_FALLTHROUGH();
default://Also Simple
if (!m_material)
m_material = SimpleMaterial::createMaterial();
@@ -1530,6 +1534,7 @@ void QQuickImageParticle::prepareNextFrame(QSGNode **node)
if (m_spriteEngine)
m_spriteEngine->updateSprites(timeStamp);//fires signals if anim changed
spritesUpdate(time);
+ Q_FALLTHROUGH();
case Tabled:
case Deformable:
case Colored:
@@ -1691,6 +1696,7 @@ void QQuickImageParticle::initialize(int gIdx, int pIdx)
writeTo->animWidth = getState<ImageMaterialData>(m_material)->animSheetSize.width();
writeTo->animHeight = getState<ImageMaterialData>(m_material)->animSheetSize.height();
}
+ Q_FALLTHROUGH();
case Tabled:
case Deformable:
//Initial Rotation
@@ -1737,6 +1743,7 @@ void QQuickImageParticle::initialize(int gIdx, int pIdx)
getShadowDatum(datum)->autoRotate = autoRotate;
}
}
+ Q_FALLTHROUGH();
case Colored:
//Color initialization
// Particle color
diff --git a/src/plugins/qmltooling/qmltooling.pro b/src/plugins/qmltooling/qmltooling.pro
index 8123e2999e..27c51b53c8 100644
--- a/src/plugins/qmltooling/qmltooling.pro
+++ b/src/plugins/qmltooling/qmltooling.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
-QT_FOR_CONFIG += qml
+QT_FOR_CONFIG += qml-private
# Utilities
SUBDIRS += \
@@ -10,25 +10,28 @@ SUBDIRS += \
qmldbg_native \
qmldbg_server
+qmldbg_native.depends = packetprotocol
+qmldbg_server.depends = packetprotocol
+
qtConfig(qml-network) {
SUBDIRS += \
qmldbg_local \
qmldbg_tcp
}
-# Services
-SUBDIRS += \
- qmldbg_debugger \
- qmldbg_profiler \
- qmldbg_messages \
- qmldbg_nativedebugger
+qtConfig(qml-interpreter) {
+ # Services
+ SUBDIRS += \
+ qmldbg_debugger \
+ qmldbg_profiler \
+ qmldbg_messages \
+ qmldbg_nativedebugger
-qmldbg_server.depends = packetprotocol
-qmldbg_native.depends = packetprotocol
-qmldbg_debugger.depends = packetprotocol
-qmldbg_profiler.depends = packetprotocol
-qmldbg_messages.depends = packetprotocol
-qmldbg_nativedebugger.depends = packetprotocol
+ qmldbg_debugger.depends = packetprotocol
+ qmldbg_profiler.depends = packetprotocol
+ qmldbg_messages.depends = packetprotocol
+ qmldbg_nativedebugger.depends = packetprotocol
+}
qtHaveModule(quick) {
SUBDIRS += \
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index cc542e94e7..62e2833089 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -2345,6 +2345,7 @@ private:
case OpIncrement:
case OpDecrement:
Q_ASSERT(!"Inplace operators should have been removed!");
+ Q_UNREACHABLE();
default:
Q_UNIMPLEMENTED();
Q_UNREACHABLE();
@@ -2645,6 +2646,7 @@ private:
case OpMul:
if (!targetTemp || !knownOk.contains(*targetTemp))
return false;
+ Q_FALLTHROUGH();
case OpBitAnd:
case OpBitOr:
case OpBitXor:
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp
index 599370f73d..c2853a39d2 100644
--- a/src/qml/jit/qv4isel_masm.cpp
+++ b/src/qml/jit/qv4isel_masm.cpp
@@ -1002,6 +1002,7 @@ void InstructionSelection<JITAssembler>::convertTypeToBool(IR::Expr *source, IR:
generateRuntimeCall(_as, JITTargetPlatform::ReturnValueRegister, toBoolean,
PointerToValue(source));
_as->storeBool(JITTargetPlatform::ReturnValueRegister, target);
+ Q_FALLTHROUGH();
case IR::VarType:
default:
Pointer addr = _as->loadAddressForReading(JITTargetPlatform::ScratchRegister, source);
diff --git a/src/qml/jit/qv4regalloc.cpp b/src/qml/jit/qv4regalloc.cpp
index 8eafaaaa8a..d418b050c4 100644
--- a/src/qml/jit/qv4regalloc.cpp
+++ b/src/qml/jit/qv4regalloc.cpp
@@ -125,6 +125,7 @@ protected:
*out << ri->prettyName();
break;
}
+ Q_FALLTHROUGH();
}
default:
IRPrinterWithPositions::visitTemp(e);
@@ -662,6 +663,7 @@ protected: // IRDecoder
addUses(rightSource->asTemp(), Use::MustHaveRegister);
break;
}
+ Q_FALLTHROUGH();
#endif
case OpBitAnd:
case OpBitOr:
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index 806a614e95..2735883603 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -183,7 +183,7 @@ ExecutionEngine::ExecutionEngine(EvalISelFactory *factory)
"solutions for your platform.");
}
#else
- factory = new JIT::ISelFactory;
+ factory = new JIT::ISelFactory<>;
#endif
}
iselFactory.reset(factory);
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index b28a5f9000..9da0df326f 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -472,6 +472,7 @@ Heap::String *RuntimeHelpers::convertToString(ExecutionEngine *engine, const Val
switch (value.type()) {
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
+ Q_UNREACHABLE();
case Value::Undefined_Type:
return engine->id_undefined()->d();
case Value::Null_Type:
@@ -504,6 +505,7 @@ static Heap::String *convert_to_string_add(ExecutionEngine *engine, const Value
switch (value.type()) {
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
+ Q_UNREACHABLE();
case Value::Undefined_Type:
return engine->id_undefined()->d();
case Value::Null_Type:
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index e34ac9c764..f41442df7a 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -113,6 +113,7 @@ double Value::toNumberImpl() const
case QV4::Value::Managed_Type:
#ifdef V4_BOOTSTRAP
Q_UNIMPLEMENTED();
+ Q_FALLTHROUGH();
#else
if (String *s = stringValue())
return RuntimeHelpers::stringToNumber(s->toQString());
@@ -140,6 +141,7 @@ QString Value::toQStringNoThrow() const
switch (type()) {
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
+ Q_UNREACHABLE();
case Value::Undefined_Type:
return QStringLiteral("undefined");
case Value::Null_Type:
@@ -193,6 +195,7 @@ QString Value::toQString() const
switch (type()) {
case Value::Empty_Type:
Q_ASSERT(!"empty Value encountered");
+ Q_UNREACHABLE();
case Value::Undefined_Type:
return QStringLiteral("undefined");
case Value::Null_Type:
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index a0cfd5d925..c4bd1a733f 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -165,6 +165,13 @@ struct MemorySegment {
size_t pageSize = WTF::pageSize();
size = (size + pageSize - 1) & ~(pageSize - 1);
+#if !defined(Q_OS_LINUX) && !defined(Q_OS_WIN)
+ // Linux and Windows zero out pages that have been decommitted and get committed again.
+ // unfortunately that's not true on other OSes (e.g. BSD based ones), so zero out the
+ // memory before decommit, so that we can be sure that all chunks we allocate will be
+ // zero initialized.
+ memset(chunk, 0, size);
+#endif
pageReservation.decommit(chunk, size);
}
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index dab35f2a54..bda3250c16 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -889,7 +889,7 @@ void QQuickCanvasItem::getContext(QQmlV4Function *args)
}
/*!
- \qmlmethod long QtQuick::Canvas::requestAnimationFrame(callback)
+ \qmlmethod int QtQuick::Canvas::requestAnimationFrame(callback)
This function schedules callback to be invoked before composing the Qt Quick
scene.
@@ -919,7 +919,7 @@ void QQuickCanvasItem::requestAnimationFrame(QQmlV4Function *args)
}
/*!
- \qmlmethod QtQuick::Canvas::cancelRequestAnimationFrame(long handle)
+ \qmlmethod QtQuick::Canvas::cancelRequestAnimationFrame(int handle)
This function will cancel the animation callback referenced by \a handle.
*/
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp
index 62119effb2..1882976e0c 100644
--- a/src/quick/items/qquickmultipointtoucharea.cpp
+++ b/src/quick/items/qquickmultipointtoucharea.cpp
@@ -176,8 +176,6 @@ void QQuickTouchPoint::setVelocity(const QVector2D &velocity)
It is deprecated because a touch point is more correctly modeled as an ellipse,
whereas this rectangle represents the outer bounds of the ellipse after \l rotation.
-
- \sa horizontalDiameter, verticalDiameter
*/
void QQuickTouchPoint::setArea(const QRectF &area)
{
diff --git a/src/quick/items/qquicktextinput.cpp b/src/quick/items/qquicktextinput.cpp
index 1edff3ff83..f4a88a1c45 100644
--- a/src/quick/items/qquicktextinput.cpp
+++ b/src/quick/items/qquicktextinput.cpp
@@ -3885,6 +3885,7 @@ void QQuickTextInputPrivate::parseInputMask(const QString &maskFields)
break;
case '\\':
escape = true;
+ Q_FALLTHROUGH();
default:
s = true;
break;
diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
index d4324bc489..14f8514289 100644
--- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
+++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp
@@ -338,7 +338,7 @@ void Updater::visitNode(Node *n)
case QSGNode::RenderNodeType:
if (m_added)
n->renderNodeElement()->root = m_roots.last();
- // Fall through to visit children.
+ Q_FALLTHROUGH(); // to visit children
default:
SHADOWNODE_TRAVERSE(n) visitNode(child);
break;
diff --git a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
index 48ab1aa52f..2b70139b37 100644
--- a/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
+++ b/src/quick/scenegraph/coreapi/qsgshaderrewriter.cpp
@@ -133,6 +133,7 @@ Tokenizer::Token Tokenizer::next()
pos += 3;
return Token_Void;
}
+ Q_FALLTHROUGH();
}
case ';': return Token_SemiColon;
diff --git a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
index d8f92919cb..e134a5d4d3 100644
--- a/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
+++ b/src/quick/scenegraph/util/qsgshadersourcebuilder.cpp
@@ -122,6 +122,7 @@ Tokenizer::Token Tokenizer::next()
case '*':
if (*pos == '/')
return Token_MultiLineCommentEnd;
+ Q_FALLTHROUGH();
case '\n':
return Token_NewLine;
@@ -129,6 +130,7 @@ Tokenizer::Token Tokenizer::next()
case '\r':
if (*pos == '\n')
return Token_NewLine;
+ Q_FALLTHROUGH();
case '#': {
if (*pos == 'v' && pos[1] == 'e' && pos[2] == 'r' && pos[3] == 's'
@@ -177,7 +179,7 @@ Tokenizer::Token Tokenizer::next()
pos += 3;
return Token_Void;
}
- // Fall-thru
+ Q_FALLTHROUGH();
}
default:
// Identifier...
diff --git a/tests/auto/qml/qqmlengine/data/testGCCorruption.qml b/tests/auto/qml/qqmlengine/data/testGCCorruption.qml
new file mode 100644
index 0000000000..8728b9b915
--- /dev/null
+++ b/tests/auto/qml/qqmlengine/data/testGCCorruption.qml
@@ -0,0 +1,29 @@
+import QtQml 2.0
+
+QtObject {
+ id: root
+ property int count: 10000;
+ property var items: [];
+
+ property Component component: Component {
+ id: component;
+ QtObject {
+ }
+ }
+
+ property int iterations: 0
+ Component.onCompleted: {
+ for (var iterations = 0; iterations < 5; ++iterations) {
+ for (var i=0; i<items.length; ++i) {
+ items[i].destroy();
+ }
+
+ for (var i=0; i<root.count; ++i) {
+ var object = component.createObject();
+ items[i] = object
+ }
+ }
+
+ // if we crash, then something bad has happened. :)
+ }
+}
diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
index e170920486..3f6107ab2b 100644
--- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
+++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp
@@ -70,8 +70,8 @@ private slots:
void qtqmlModule();
void urlInterceptor_data();
void urlInterceptor();
-
void qmlContextProperties();
+ void testGCCorruption();
public slots:
QObject *createAQObjectForOwnershipTest ()
@@ -836,6 +836,15 @@ void tst_qqmlengine::qmlContextProperties()
QVERIFY(o);
}
+void tst_qqmlengine::testGCCorruption()
+{
+ QQmlEngine e;
+
+ QQmlComponent c(&e, testFileUrl("testGCCorruption.qml"));
+ QObject *o = c.create();
+ QVERIFY2(o, qPrintable(c.errorString()));
+}
+
QTEST_MAIN(tst_qqmlengine)
#include "tst_qqmlengine.moc"