aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2019-01-22 10:35:09 +0100
committerLiang Qi <liang.qi@qt.io>2019-01-22 11:20:29 +0100
commit1b4d2741f90d3f4daf79940b9c8713dda0fb7f3d (patch)
tree40cee4f6af7bf9a5fc87c43f024f417a5d09e18d /src
parent536868fad50778ec5bf4c6c7269c721b05d8a2d5 (diff)
parent84e15a609b37a64baf82ed20f8d4f79474989226 (diff)
Merge remote-tracking branch 'origin/5.12' into dev
Conflicts: .qmake.conf tests/auto/quick/qquickpathview/tst_qquickpathview.cpp Change-Id: Ic1f5e219a255d0613f7654368a5ce3eccb8f0ee9
Diffstat (limited to 'src')
-rw-r--r--src/particles/qquickcustomparticle.cpp1
-rw-r--r--src/qml/compiler/qv4compileddata.cpp2
-rw-r--r--src/qml/jsapi/qjsvalue.cpp6
-rw-r--r--src/qml/jsruntime/qv4engine.cpp5
-rw-r--r--src/qml/jsruntime/qv4functionobject.cpp1
-rw-r--r--src/qml/jsruntime/qv4stackframe_p.h2
-rw-r--r--src/qml/qml/qqmlbinding.cpp13
-rw-r--r--src/qml/qml/qqmlcomponent.cpp8
-rw-r--r--src/qml/qml/qqmlengine.cpp4
-rw-r--r--src/qml/qml/qqmllist.cpp6
-rw-r--r--src/qml/qml/qqmlmetatype.cpp16
-rw-r--r--src/quick/items/qquickitem.cpp6
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer.cpp7
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h9
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp4
-rw-r--r--src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgtexture.cpp2
-rw-r--r--src/quick/util/qquickimageprovider.cpp2
18 files changed, 53 insertions, 43 deletions
diff --git a/src/particles/qquickcustomparticle.cpp b/src/particles/qquickcustomparticle.cpp
index 8528a6f750..85056dffa9 100644
--- a/src/particles/qquickcustomparticle.cpp
+++ b/src/particles/qquickcustomparticle.cpp
@@ -39,6 +39,7 @@
#include "qquickcustomparticle_p.h"
#include <QtCore/qrandom.h>
+#include <QtGui/qopenglcontext.h>
#include <QtQuick/private/qquickshadereffectmesh_p.h>
#include <QtQuick/private/qsgshadersourcebuilder_p.h>
#include <QtQml/qqmlinfo.h>
diff --git a/src/qml/compiler/qv4compileddata.cpp b/src/qml/compiler/qv4compileddata.cpp
index 9379160a65..a69e862fb7 100644
--- a/src/qml/compiler/qv4compileddata.cpp
+++ b/src/qml/compiler/qv4compileddata.cpp
@@ -756,7 +756,7 @@ QString Binding::valueAsString(const CompilationUnit *unit) const
#if !QT_CONFIG(translation)
case Type_TranslationById:
case Type_Translation:
- return unit->stringAt(unit->unitData->translations()[value.translationDataIndex].stringIndex);
+ return unit->stringAt(unit->unitData()->translations()[value.translationDataIndex].stringIndex);
#else
case Type_TranslationById: {
const TranslationData &translation = unit->unitData()->translations()[value.translationDataIndex];
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 225a4443d9..f6fb93eab3 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -1343,11 +1343,11 @@ bool QJSValue::hasOwnProperty(const QString &name) const
/*!
* If this QJSValue is a QObject, returns the QObject pointer
- * that the QJSValue represents; otherwise, returns 0.
+ * that the QJSValue represents; otherwise, returns \nullptr.
*
* If the QObject that this QJSValue wraps has been deleted,
- * this function returns 0 (i.e. it is possible for toQObject()
- * to return 0 even when isQObject() returns true).
+ * this function returns \nullptr (i.e. it is possible for toQObject()
+ * to return \nullptr even when isQObject() returns true).
*
* \sa isQObject()
*/
diff --git a/src/qml/jsruntime/qv4engine.cpp b/src/qml/jsruntime/qv4engine.cpp
index ff7bcb63fa..a482cc6a67 100644
--- a/src/qml/jsruntime/qv4engine.cpp
+++ b/src/qml/jsruntime/qv4engine.cpp
@@ -1011,6 +1011,11 @@ StackTrace ExecutionEngine::stackTrace(int frameLimit) const
frame.line = qAbs(f->lineNumber());
frame.column = -1;
stack.append(frame);
+ if (f->isTailCalling) {
+ QV4::StackFrame frame;
+ frame.function = QStringLiteral("[elided tail calls]");
+ stack.append(frame);
+ }
--frameLimit;
f = f->parent;
}
diff --git a/src/qml/jsruntime/qv4functionobject.cpp b/src/qml/jsruntime/qv4functionobject.cpp
index dfe9d35194..41a21ba379 100644
--- a/src/qml/jsruntime/qv4functionobject.cpp
+++ b/src/qml/jsruntime/qv4functionobject.cpp
@@ -518,6 +518,7 @@ ReturnedValue ArrowFunction::virtualCall(const FunctionObject *fo, const Value *
do {
frame.pendingTailCall = false;
result = Moth::VME::exec(&frame, engine);
+ frame.isTailCalling = true;
} while (frame.pendingTailCall);
frame.pop();
diff --git a/src/qml/jsruntime/qv4stackframe_p.h b/src/qml/jsruntime/qv4stackframe_p.h
index a97ae0e7c9..44cfef9173 100644
--- a/src/qml/jsruntime/qv4stackframe_p.h
+++ b/src/qml/jsruntime/qv4stackframe_p.h
@@ -125,6 +125,7 @@ struct Q_QML_EXPORT CppStackFrame {
bool yieldIsIterator;
bool callerCanHandleTailCall;
bool pendingTailCall;
+ bool isTailCalling;
void init(EngineBase *engine, Function *v4Function, const Value *argv, int argc, bool callerCanHandleTailCall = false) {
this->engine = engine;
@@ -140,6 +141,7 @@ struct Q_QML_EXPORT CppStackFrame {
yieldIsIterator = false;
this->callerCanHandleTailCall = callerCanHandleTailCall;
pendingTailCall = false;
+ isTailCalling = false;
}
void push() {
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 024ec29a56..a949df4968 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -517,11 +517,14 @@ QVariant QQmlBinding::evaluate()
QString QQmlBinding::expressionIdentifier() const
{
- auto f = function();
- QString url = f->sourceFile();
- quint16 lineNumber = f->compiledFunction->location.line;
- quint16 columnNumber = f->compiledFunction->location.column;
- return url + QString::asprintf(":%u:%u", uint(lineNumber), uint(columnNumber));
+ if (auto f = function()) {
+ QString url = f->sourceFile();
+ quint16 lineNumber = f->compiledFunction->location.line;
+ quint16 columnNumber = f->compiledFunction->location.column;
+ return url + QString::asprintf(":%u:%u", uint(lineNumber), uint(columnNumber));
+ }
+
+ return QStringLiteral("[native code]");
}
void QQmlBinding::expressionChanged()
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 5ed3cc5d6a..57ea685a5d 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -756,12 +756,12 @@ QQmlComponent::QQmlComponent(QQmlComponentPrivate &dd, QObject *parent)
}
/*!
- Create an object instance from this component. Returns 0 if creation
+ Create an object instance from this component. Returns \nullptr if creation
failed. \a context specifies the context within which to create the object
instance.
- If \a context is 0 (the default), it will create the instance in the
- engine' s \l {QQmlEngine::rootContext()}{root context}.
+ If \a context is \nullptr (the default), it will create the instance in the
+ \l {QQmlEngine::rootContext()}{root context} of the engine.
The ownership of the returned object instance is transferred to the caller.
@@ -791,7 +791,7 @@ QObject *QQmlComponent::create(QQmlContext *context)
In general, programmers should use QQmlComponent::create() to create object
instances.
- Create an object instance from this component. Returns 0 if creation
+ Create an object instance from this component. Returns \nullptr if creation
failed. \a publicContext specifies the context within which to create the object
instance.
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp
index 6db43a50eb..5841a480fc 100644
--- a/src/qml/qml/qqmlengine.cpp
+++ b/src/qml/qml/qqmlengine.cpp
@@ -1304,9 +1304,7 @@ void QQmlEngine::addImageProvider(const QString &providerId, QQmlImageProviderBa
}
/*!
- Returns the image provider set for \a providerId.
-
- Returns the provider if it was found; otherwise returns 0.
+ Returns the image provider set for \a providerId if found; otherwise returns \nullptr.
\sa QQuickImageProvider
*/
diff --git a/src/qml/qml/qqmllist.cpp b/src/qml/qml/qqmllist.cpp
index 656a8a470b..5425bf498c 100644
--- a/src/qml/qml/qqmllist.cpp
+++ b/src/qml/qml/qqmllist.cpp
@@ -184,7 +184,7 @@ bool QQmlListReference::isValid() const
}
/*!
-Returns the list property's object. Returns 0 if the reference is invalid.
+Returns the list property's object. Returns \nullptr if the reference is invalid.
*/
QObject *QQmlListReference::object() const
{
@@ -193,8 +193,8 @@ QObject *QQmlListReference::object() const
}
/*!
-Returns the QMetaObject for the elements stored in the list property. Returns 0 if the reference
-is invalid.
+Returns the QMetaObject for the elements stored in the list property,
+or \nullptr if the reference is invalid.
The QMetaObject can be used ahead of time to determine whether a given instance can be added
to a list.
diff --git a/src/qml/qml/qqmlmetatype.cpp b/src/qml/qml/qqmlmetatype.cpp
index c05ae27b93..032ee7d6fc 100644
--- a/src/qml/qml/qqmlmetatype.cpp
+++ b/src/qml/qml/qqmlmetatype.cpp
@@ -497,9 +497,9 @@ QQmlType::QQmlType(QQmlMetaTypeData *data, const QString &elementName, const QQm
d->extraData.cd->attachedPropertiesFunc = type.attachedPropertiesFunction;
d->extraData.cd->attachedPropertiesType = type.attachedPropertiesMetaObject;
if (d->extraData.cd->attachedPropertiesType) {
- QHash<const QMetaObject *, int>::Iterator iter = d->attachedPropertyIds.find(d->baseMetaObject);
- if (iter == d->attachedPropertyIds.end())
- iter = d->attachedPropertyIds.insert(d->baseMetaObject, d->index);
+ auto iter = QQmlTypePrivate::attachedPropertyIds.find(d->baseMetaObject);
+ if (iter == QQmlTypePrivate::attachedPropertyIds.end())
+ iter = QQmlTypePrivate::attachedPropertyIds.insert(d->baseMetaObject, d->index);
d->extraData.cd->attachedPropertiesId = *iter;
} else {
d->extraData.cd->attachedPropertiesId = -1;
@@ -569,8 +569,16 @@ QQmlType::QQmlType(QQmlTypePrivate *priv)
QQmlType::~QQmlType()
{
- if (d && !d->refCount.deref())
+ if (d && !d->refCount.deref()) {
+ // If attached properties were successfully registered, deregister them.
+ // (They may not have been registered if some other type used the same baseMetaObject)
+ if (d->regType == CppType && d->extraData.cd->attachedPropertiesType) {
+ auto it = QQmlTypePrivate::attachedPropertyIds.find(d->baseMetaObject);
+ if (it != QQmlTypePrivate::attachedPropertyIds.end() && *it == d->index)
+ QQmlTypePrivate::attachedPropertyIds.erase(it);
+ }
delete d;
+ }
}
QHashedString QQmlType::module() const
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 0cd4c446d9..ec6bf5a1b8 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -4800,7 +4800,7 @@ QQuickItem *QQuickItem::nextItemInFocusChain(bool forward)
Returns the first visible child item found at point (\a x, \a y) within
the coordinate system of this item.
- Returns 0 if there is no such item.
+ Returns \nullptr if there is no such item.
*/
QQuickItem *QQuickItem::childAt(qreal x, qreal y) const
{
@@ -7224,7 +7224,7 @@ bool QQuickItem::isFocusScope() const
If this item is a focus scope, this returns the item in its focus chain
that currently has focus.
- Returns 0 if this item is not a focus scope.
+ Returns \nullptr if this item is not a focus scope.
*/
QQuickItem *QQuickItem::scopedFocusItem() const
{
@@ -8160,7 +8160,7 @@ bool QQuickItem::isTextureProvider() const
\fn QSGTextureProvider *QQuickItem::textureProvider() const
Returns the texture provider for an item. The default implementation
- returns 0.
+ returns \nullptr.
This function may only be called on the rendering thread.
*/
diff --git a/src/quick/scenegraph/qsgadaptationlayer.cpp b/src/quick/scenegraph/qsgadaptationlayer.cpp
index c99e149aa5..252e5a9c55 100644
--- a/src/quick/scenegraph/qsgadaptationlayer.cpp
+++ b/src/quick/scenegraph/qsgadaptationlayer.cpp
@@ -56,7 +56,7 @@ static QElapsedTimer qsg_render_timer;
QSGDistanceFieldGlyphCache::Texture QSGDistanceFieldGlyphCache::s_emptyTexture;
-QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font)
+QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(const QRawFont &font)
: m_pendingGlyphs(64)
{
Q_ASSERT(font.isValid());
@@ -71,11 +71,6 @@ QSGDistanceFieldGlyphCache::QSGDistanceFieldGlyphCache(QOpenGLContext *c, const
// this allows us to call pathForGlyph once and reuse the result.
m_referenceFont.setPixelSize(QT_DISTANCEFIELD_BASEFONTSIZE(m_doubleGlyphResolution) * QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution));
Q_ASSERT(m_referenceFont.isValid());
-#if QT_CONFIG(opengl)
- m_coreProfile = (c->format().profile() == QSurfaceFormat::CoreProfile);
-#else
- Q_UNUSED(c)
-#endif
}
QSGDistanceFieldGlyphCache::~QSGDistanceFieldGlyphCache()
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index ba5c4353b2..58ecae94e7 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_p.h
@@ -62,7 +62,6 @@
#include <QtCore/qurl.h>
#include <private/qfontengine_p.h>
#include <QtGui/private/qdatabuffer_p.h>
-#include <private/qopenglcontext_p.h>
#include <private/qdistancefield_p.h>
#include <private/qintrusivelist_p.h>
@@ -75,7 +74,6 @@ class QSGNode;
class QImage;
class TextureReference;
class QSGDistanceFieldGlyphNode;
-class QOpenGLContext;
class QSGInternalImageNode;
class QSGPainterNode;
class QSGInternalRectangleNode;
@@ -413,7 +411,7 @@ typedef QIntrusiveList<QSGDistanceFieldGlyphConsumer, &QSGDistanceFieldGlyphCons
class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphCache
{
public:
- QSGDistanceFieldGlyphCache(QOpenGLContext *c, const QRawFont &font);
+ QSGDistanceFieldGlyphCache(const QRawFont &font);
virtual ~QSGDistanceFieldGlyphCache();
struct Metrics {
@@ -514,8 +512,6 @@ protected:
void saveTexture(GLuint textureId, int width, int height) const;
#endif
- inline bool isCoreProfile() const { return m_coreProfile; }
-
bool m_doubleGlyphResolution;
protected:
@@ -523,9 +519,6 @@ protected:
private:
int m_glyphCount;
-
- bool m_coreProfile;
-
QList<Texture> m_textures;
QHash<glyph_t, GlyphData> m_glyphsData;
QDataBuffer<glyph_t> m_pendingGlyphs;
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
index ccc57b0b86..8121b4559e 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache.cpp
@@ -67,7 +67,7 @@ DEFINE_BOOL_CONFIG_OPTION(qsgPreferFullSizeGlyphCacheTextures, QSG_PREFER_FULLSI
QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QOpenGLContext *c,
const QRawFont &font)
- : QSGDistanceFieldGlyphCache(c, font)
+ : QSGDistanceFieldGlyphCache(font)
, m_maxTextureSize(0)
, m_maxTextureCount(3)
, m_areaAllocator(nullptr)
@@ -89,6 +89,8 @@ QSGDefaultDistanceFieldGlyphCache::QSGDefaultDistanceFieldGlyphCache(QOpenGLCont
qWarning("Buffer creation failed");
}
+ m_coreProfile = (c->format().profile() == QSurfaceFormat::CoreProfile);
+
// Load a pregenerated cache if the font contains one
loadPregeneratedCache(font);
}
diff --git a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
index a0e4387af9..c64adddd91 100644
--- a/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
+++ b/src/quick/scenegraph/qsgdefaultdistancefieldglyphcache_p.h
@@ -88,6 +88,7 @@ public:
private:
bool loadPregeneratedCache(const QRawFont &font);
+ inline bool isCoreProfile() const { return m_coreProfile; }
struct TextureInfo {
GLuint texture;
@@ -137,6 +138,7 @@ private:
mutable int m_maxTextureSize;
int m_maxTextureCount;
+ bool m_coreProfile;
QList<TextureInfo> m_textures;
QHash<glyph_t, TextureInfo *> m_glyphsTexture;
diff --git a/src/quick/scenegraph/util/qsgtexture.cpp b/src/quick/scenegraph/util/qsgtexture.cpp
index 720f08f69b..042eee19f5 100644
--- a/src/quick/scenegraph/util/qsgtexture.cpp
+++ b/src/quick/scenegraph/util/qsgtexture.cpp
@@ -389,7 +389,7 @@ QSGTexture::~QSGTexture()
it to a shader that operates on the texture coordinates 0-1 instead
of the texture subrect inside the atlas.
- If the texture is not part of a texture atlas, this function returns 0.
+ If the texture is not part of a texture atlas, this function returns \nullptr.
Implementations of this function are recommended to return the same instance
for multiple calls to limit memory usage.
diff --git a/src/quick/util/qquickimageprovider.cpp b/src/quick/util/qquickimageprovider.cpp
index ced981de3e..ebcca77f17 100644
--- a/src/quick/util/qquickimageprovider.cpp
+++ b/src/quick/util/qquickimageprovider.cpp
@@ -436,7 +436,7 @@ QPixmap QQuickImageProvider::requestPixmap(const QString &id, QSize *size, const
/*!
Implement this method to return the texture with \a id. The default
- implementation returns 0.
+ implementation returns \nullptr.
The \a id is the requested image source, with the "image:" scheme and
provider identifier removed. For example, if the image \l{Image::}{source}