From 1b73484630e1fbf483a124f77c07265d695f9484 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 8 Aug 2016 13:46:34 +0200 Subject: QML: Obliterate QQmlAccessors Change-Id: I70a080feb401cf23aef1bde44a19a11e27642f30 Reviewed-by: Simon Hausmann --- src/qml/qml/qml.pri | 2 - src/qml/qml/qqmlaccessors.cpp | 105 ---------------------- src/qml/qml/qqmlaccessors_p.h | 182 -------------------------------------- src/qml/qml/qqmlbinding.cpp | 1 - src/qml/qml/qqmlobjectcreator.cpp | 1 - src/qml/qml/qqmlpropertycache.cpp | 22 +---- src/qml/qml/qqmlpropertycache_p.h | 5 -- 7 files changed, 1 insertion(+), 317 deletions(-) delete mode 100644 src/qml/qml/qqmlaccessors.cpp delete mode 100644 src/qml/qml/qqmlaccessors_p.h (limited to 'src/qml/qml') diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri index 4244b16210..8d8da3742d 100644 --- a/src/qml/qml/qml.pri +++ b/src/qml/qml/qml.pri @@ -20,7 +20,6 @@ SOURCES += \ $$PWD/qqmlinfo.cpp \ $$PWD/qqmlerror.cpp \ $$PWD/qqmlvaluetype.cpp \ - $$PWD/qqmlaccessors.cpp \ $$PWD/qqmlxmlhttprequest.cpp \ $$PWD/qqmlcleanup.cpp \ $$PWD/qqmlpropertycache.cpp \ @@ -87,7 +86,6 @@ HEADERS += \ $$PWD/qqmldata_p.h \ $$PWD/qqmlerror.h \ $$PWD/qqmlvaluetype_p.h \ - $$PWD/qqmlaccessors_p.h \ $$PWD/qqmlxmlhttprequest_p.h \ $$PWD/qqmlcleanup_p.h \ $$PWD/qqmlpropertycache_p.h \ diff --git a/src/qml/qml/qqmlaccessors.cpp b/src/qml/qml/qqmlaccessors.cpp deleted file mode 100644 index 7b0fafdc90..0000000000 --- a/src/qml/qml/qqmlaccessors.cpp +++ /dev/null @@ -1,105 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qqmlaccessors_p.h" - -#include "qqmldata_p.h" -#include "qqmlnotifier_p.h" - -QT_BEGIN_NAMESPACE - -struct AccessorProperties { - AccessorProperties(); - - QReadWriteLock lock; - QHash properties; -}; - -Q_GLOBAL_STATIC(AccessorProperties, accessorProperties) - -static void buildNameMask(QQmlAccessorProperties::Properties &properties) -{ - quint32 mask = 0; - - for (int ii = 0; ii < properties.count; ++ii) { - Q_ASSERT(strlen(properties.properties[ii].name) == properties.properties[ii].nameLength); - Q_ASSERT(properties.properties[ii].nameLength > 0); - - mask |= (1 << qMin(31U, properties.properties[ii].nameLength - 1)); - } - - properties.nameMask = mask; -} - -AccessorProperties::AccessorProperties() -{ -} - -QQmlAccessorProperties::Properties::Properties(Property *properties, int count) -: count(count), properties(properties) -{ - buildNameMask(*this); -} - -QQmlAccessorProperties::Properties -QQmlAccessorProperties::properties(const QMetaObject *mo) -{ - AccessorProperties *This = accessorProperties(); - - QReadLocker lock(&This->lock); - return This->properties.value(mo); -} - -void QQmlAccessorProperties::registerProperties(const QMetaObject *mo, int count, - Property *props) -{ - Q_ASSERT(count > 0); - - Properties properties(props, count); - - AccessorProperties *This = accessorProperties(); - - QWriteLocker lock(&This->lock); - - Q_ASSERT(!This->properties.contains(mo) || This->properties.value(mo) == properties); - - This->properties.insert(mo, properties); -} - -QT_END_NAMESPACE diff --git a/src/qml/qml/qqmlaccessors_p.h b/src/qml/qml/qqmlaccessors_p.h deleted file mode 100644 index e98663adfe..0000000000 --- a/src/qml/qml/qqmlaccessors_p.h +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQml module 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 The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/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 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QQMLACCESSORS_P_H -#define QQMLACCESSORS_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include -#include -#include -#include -#include - -#if defined(Q_OS_QNX) || defined(Q_OS_LINUX) -#include -#endif - -QT_BEGIN_NAMESPACE - -class QObject; -struct QMetaObject; -class QQmlNotifier; - -// QML "accessor properties" allow V4 and V8 to bypass Qt's meta system to read and, more -// importantly, subscribe to properties directly. Any property that is primarily read -// from bindings is a candidate for inclusion as an accessor property. -// -// To define accessor properties, use the QML_DECLARE_PROPERTIES() and QML_DEFINE_PROPERTIES() -// macros. The QML_DECLARE_PROPERTIES() macro is used to specify the properties, and the -// QML_DEFINE_PROPERTIES() macro to register the properties with the -// QQmlAccessorProperties singleton. -// -// A class with accessor properties must also add the Q_CLASSINFO("qt_HasQmlAccessors", "true") -// tag to its declaration. This is essential for QML to maintain internal consistency, -// and forgetting to do so will probably cause your application to qFatal() with a -// helpful reminder of this requirement. -// -// It is important that QML_DEFINE_PROPERTIES() has been called before QML ever sees -// the type with the accessor properties. As QML_DEFINE_PROPERTIES() is idempotent, it is -// recommended to call it in the type's constructor as well as when the type is registered -// as a QML element (if it ever is). QML_DEFINE_PROPERTIES() is a very cheap operation -// if registration has already occurred. - -#define QML_DECLARE_PROPERTIES(type) \ - static volatile bool qqml_accessor_properties_isregistered_ ## type = false; \ - static QQmlAccessorProperties::Property qqml_accessor_properties_ ## type[] = - -#define QML_DEFINE_PROPERTIES(type) \ - do { \ - if (!qqml_accessor_properties_isregistered_ ## type) { \ - int count = sizeof(qqml_accessor_properties_ ## type) / \ - sizeof(QQmlAccessorProperties::Property); \ - QQmlAccessorProperties::registerProperties(&type::staticMetaObject, count, \ - qqml_accessor_properties_ ## type);\ - qqml_accessor_properties_isregistered_ ## type = true; \ - } \ - } while (false); - -#define QML_PRIVATE_ACCESSOR(clazz, cpptype, name, variable, setter) \ - static void clazz ## _ ## name ## Read(QObject *o, void *rv) \ - { \ - clazz ## Private *d = clazz ## Private::get(static_cast(o)); \ - *static_cast(rv) = d->variable; \ - } \ - static void clazz ## _ ## name ## Write(QObject *o, void *rv) \ - { \ - static_cast(o)->setter(*static_cast(rv)); \ - } - -#define QML_PROPERTY_NAME(name) #name, sizeof #name - 1 - -class QQmlAccessors -{ -public: - void (*read)(QObject *object, void *output); - void (*write)(QObject *object, void *output); - void (*notifier)(QObject *object, QQmlNotifier **notifier); -}; - -namespace QQmlAccessorProperties { - struct Property { - const char *name; - unsigned int nameLength; - qintptr data; - QQmlAccessors *accessors; - }; - - struct Properties { - inline Properties(); - Properties(Property *, int); - - bool operator==(const Properties &o) const { - return count == o.count && properties == o.properties; - } - - inline Property *property(const char *name); - - int count; - Property *properties; - quint32 nameMask; - }; - - Properties properties(const QMetaObject *); - void Q_QML_PRIVATE_EXPORT registerProperties(const QMetaObject *, int, Property *); -}; - -QQmlAccessorProperties::Property * -QQmlAccessorProperties::Properties::property(const char *name) -{ - if (count == 0) - return 0; - - const unsigned int length = (unsigned int)strlen(name); - - Q_ASSERT(length); - - if (nameMask & (1 << qMin(31U, length - 1))) { - - for (int ii = 0; ii < count; ++ii) { - if (properties[ii].nameLength == length && 0 == qstrcmp(name, properties[ii].name)) - return &properties[ii]; - } - - } - - return 0; -} - -QQmlAccessorProperties::Properties::Properties() -: count(0), properties(0), nameMask(0) -{ -} - -QT_END_NAMESPACE - -#endif // QQMLACCESSORS_P_H diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index d944857fc1..896bc8d51d 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -43,7 +43,6 @@ #include "qqmlcontext.h" #include "qqmlinfo.h" #include "qqmldata_p.h" -#include "qqmlaccessors_p.h" #include #include #include diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index e02d362815..2218f277d6 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -54,7 +54,6 @@ #include #include #include -#include QT_USE_NAMESPACE diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index ed00eddb30..b9e2213035 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -45,7 +45,6 @@ #include #include -#include #include #include @@ -500,35 +499,16 @@ void QQmlPropertyCache::append(const QMetaObject *metaObject, int signalCount = metaObjectSignalCount(metaObject); int classInfoCount = QMetaObjectPrivate::get(metaObject)->classInfoCount; - QQmlAccessorProperties::Properties accessorProperties; - if (classInfoCount) { int classInfoOffset = metaObject->classInfoOffset(); - bool hasFastProperty = false; for (int ii = 0; ii < classInfoCount; ++ii) { int idx = ii + classInfoOffset; QMetaClassInfo mci = metaObject->classInfo(idx); const char *name = mci.name(); - if (0 == qstrcmp(name, "qt_HasQmlAccessors")) { - hasFastProperty = true; - } else if (0 == qstrcmp(name, "DefaultProperty")) { + if (0 == qstrcmp(name, "DefaultProperty")) { _defaultPropertyName = QString::fromUtf8(mci.value()); } } - - if (hasFastProperty) { - accessorProperties = QQmlAccessorProperties::properties(metaObject); - if (accessorProperties.count == 0) - qFatal("QQmlPropertyCache: %s has FastProperty class info, but has not " - "installed property accessors", metaObject->className()); - } else { -#ifndef QT_NO_DEBUG - accessorProperties = QQmlAccessorProperties::properties(metaObject); - if (accessorProperties.count != 0) - qFatal("QQmlPropertyCache: %s has fast property accessors, but is missing " - "FastProperty class info", metaObject->className()); -#endif - } } //Used to block access to QObject::destroyed() and QObject::deleteLater() from QML diff --git a/src/qml/qml/qqmlpropertycache_p.h b/src/qml/qml/qqmlpropertycache_p.h index f28b2d0599..4da02037fa 100644 --- a/src/qml/qml/qqmlpropertycache_p.h +++ b/src/qml/qml/qqmlpropertycache_p.h @@ -62,7 +62,6 @@ #include #include -#include #include @@ -73,7 +72,6 @@ class QMetaProperty; class QQmlEngine; class QJSEngine; class QQmlPropertyData; -class QQmlAccessors; class QMetaObjectBuilder; class QQmlPropertyCacheMethodArguments; class QQmlVMEMetaObject; @@ -159,7 +157,6 @@ public: bool isFinal() const { return _flags.isFinal; } bool isOverridden() const { return _flags.isOverridden; } bool isDirect() const { return _flags.isDirect; } - bool hasAccessors() const { return accessors() != nullptr; } bool hasStaticMetaCallFunction() const { return staticMetaCallFunction() != nullptr; } bool isFunction() const { return _flags.type == Flags::FunctionType; } bool isQObject() const { return _flags.type == Flags::QObjectDerivedType; } @@ -240,8 +237,6 @@ public: _metaObjectOffset = qint16(off); } - QQmlAccessors *accessors() const { return nullptr; } // TODO: remove in subsequent patch - StaticMetaCallFunction staticMetaCallFunction() const { return _staticMetaCallFunction; } void trySetStaticMetaCallFunction(StaticMetaCallFunction f, unsigned relativePropertyIndex) { -- cgit v1.2.3 From c13aa48d4cad8659af2b491e4b3ddbe46b38fcc5 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 30 Aug 2016 12:35:36 +0200 Subject: QML: treat permanent guards more like active guards Esp. when disabling notifications and marking notifiers as "done". Change-Id: I2d1c3bf048b32f68680744250e4250c3c4d76660 Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlbinding.cpp | 2 ++ src/qml/qml/qqmljavascriptexpression.cpp | 10 ++++++++-- src/qml/qml/qqmljavascriptexpression_p.h | 8 ++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index 896bc8d51d..90698c3b24 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -252,6 +252,8 @@ protected: } + cancelPermanentGuards(); + ep->dereferenceScarceResources(); } diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp index ebc4d49c36..8020bdb2be 100644 --- a/src/qml/qml/qqmljavascriptexpression.cpp +++ b/src/qml/qml/qqmljavascriptexpression.cpp @@ -115,12 +115,17 @@ QQmlJavaScriptExpression::~QQmlJavaScriptExpression() void QQmlJavaScriptExpression::setNotifyOnValueChanged(bool v) { activeGuards.setFlagValue(v); - if (!v) clearActiveGuards(); + permanentGuards.setFlagValue(v); + if (!v) { + clearActiveGuards(); + clearPermanentGuards(); + m_permanentDependenciesRegistered = false; + } } void QQmlJavaScriptExpression::resetNotifyOnValueChanged() { - clearActiveGuards(); + setNotifyOnValueChanged(false); } void QQmlJavaScriptExpression::setContext(QQmlContextData *context) @@ -429,6 +434,7 @@ void QQmlJavaScriptExpression::clearActiveGuards() void QQmlJavaScriptExpression::clearPermanentGuards() { + m_permanentDependenciesRegistered = false; while (QQmlJavaScriptExpressionGuard *g = permanentGuards.takeFirst()) g->Delete(); } diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h index a5c7a80153..5f9cffb56d 100644 --- a/src/qml/qml/qqmljavascriptexpression_p.h +++ b/src/qml/qml/qqmljavascriptexpression_p.h @@ -146,6 +146,14 @@ public: protected: void createQmlBinding(QQmlContextData *ctxt, QObject *scope, const QString &code, const QString &filename, quint16 line); + void cancelPermanentGuards() const + { + if (m_permanentDependenciesRegistered) { + for (QQmlJavaScriptExpressionGuard *it = permanentGuards.first(); it; it = permanentGuards.next(it)) + it->cancelNotify(); + } + } + private: friend class QQmlContextData; friend class QQmlPropertyCapture; -- cgit v1.2.3 From cd77297bd97bdd70d9526fb9c54ebcca8c081def Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Sun, 4 Sep 2016 11:27:18 +0300 Subject: Add qmlRegisterUncreatableMetaObject convenience function qmlRegisterUncreatableMetaObject is needed to register Q_NAMESPACE QMetaObjects. Task-number: QTBUG-54982 Change-Id: I767dfcb15db647e0dceb0c37b17e64f2a5c1dd8f Reviewed-by: Simon Hausmann --- src/qml/qml/qqml.h | 3 +++ src/qml/qml/qqmlengine.cpp | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqml.h b/src/qml/qml/qqml.h index 8fb710ad9d..39764b8001 100644 --- a/src/qml/qml/qqml.h +++ b/src/qml/qml/qqml.h @@ -238,6 +238,9 @@ int qmlRegisterExtendedUncreatableType(const char *uri, int versionMajor, int ve return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type); } + +Q_QML_EXPORT int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, const char *uri, int versionMajor, int versionMinor, const char *qmlName, const QString& reason); + template int qmlRegisterType(const char *uri, int versionMajor, int versionMinor, const char *qmlName) { diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 7e4fe73ba1..cb51c18925 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -116,6 +116,39 @@ void qmlRegisterBaseTypes(const char *uri, int versionMajor, int versionMinor) QQmlValueTypeFactory::registerValueTypes(uri, versionMajor, versionMinor); } +// Declared in qqml.h +int qmlRegisterUncreatableMetaObject(const QMetaObject &staticMetaObject, + const char *uri, int versionMajor, + int versionMinor, const char *qmlName, + const QString& reason) +{ + QQmlPrivate::RegisterType type = { + 0, + + 0, + 0, + 0, + Q_NULLPTR, + reason, + + uri, versionMajor, versionMinor, qmlName, &staticMetaObject, + + QQmlAttachedPropertiesFunc(), + Q_NULLPTR, + + 0, + 0, + 0, + + Q_NULLPTR, Q_NULLPTR, + + Q_NULLPTR, + 0 + }; + + return QQmlPrivate::qmlregister(QQmlPrivate::TypeRegistration, &type); +} + /*! \qmltype QtObject \instantiates QObject -- cgit v1.2.3 From 777109347c837b07b4463d68257cda65ed7f3bac Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sat, 10 Sep 2016 13:00:48 -0700 Subject: Use the stringData() function from qmetaobject.cpp It does some extra checking. This adds a comment so that we won't forget to update it if the source changes too. Change-Id: I9093948278414644a416fffd14730eb6b8dfe585 Reviewed-by: Ulf Hermann Reviewed-by: Simon Hausmann --- src/qml/qml/qqmlpropertycache.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index b9e2213035..337c37b5be 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -1091,9 +1091,21 @@ QQmlPropertyCache::property(QJSEngine *engine, QObject *obj, return qQmlPropertyCacheProperty(engine, obj, name, context, local); } +// these two functions are copied from qmetaobject.cpp static inline const QMetaObjectPrivate *priv(const uint* data) { return reinterpret_cast(data); } +static inline const QByteArray stringData(const QMetaObject *mo, int index) +{ + Q_ASSERT(priv(mo->d.data)->revision >= 7); + const QByteArrayDataPtr data = { const_cast(&mo->d.stringdata[index]) }; + Q_ASSERT(data.ptr->ref.isStatic()); + Q_ASSERT(data.ptr->alloc == 0); + Q_ASSERT(data.ptr->capacityReserved == 0); + Q_ASSERT(data.ptr->size >= 0); + return data; +} + bool QQmlPropertyCache::isDynamicMetaObject(const QMetaObject *mo) { return priv(mo->d.data)->revision >= 3 && priv(mo->d.data)->flags & DynamicMetaObject; @@ -1399,8 +1411,7 @@ bool QQmlPropertyCache::addToHash(QCryptographicHash &hash, const QMetaObject &m hash.addData(reinterpret_cast(mo.d.data), fieldCount * sizeof(uint)); for (int i = 0; i < stringCount; ++i) { - const QByteArrayDataPtr data = { const_cast(&mo.d.stringdata[i]) }; - hash.addData(QByteArray(data)); + hash.addData(stringData(&mo, i)); } return true; -- cgit v1.2.3 From 893140169557eb06d79e783d38673217deab28c1 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 12 Sep 2016 14:13:30 +0200 Subject: QML: Fix xmlhttprequestdata leak The creation and deletion condetion were different. We can unconditionally delete it, because the field is always initialized to nullptr. Change-Id: If7d4528d9cdf03d81d37b3b4d4bd24fcd0fca8ef Reviewed-by: Simon Hausmann --- src/qml/qml/v8/qv8engine.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp index e08ff3b979..f15020f6c9 100644 --- a/src/qml/qml/v8/qv8engine.cpp +++ b/src/qml/qml/v8/qv8engine.cpp @@ -160,10 +160,9 @@ QV8Engine::~QV8Engine() qDeleteAll(m_extensionData); m_extensionData.clear(); -#if !defined(QT_NO_XMLSTREAMREADER) && defined(QT_NO_NETWORK) qt_rem_qmlxmlhttprequest(m_v4Engine, m_xmlHttpRequestData); m_xmlHttpRequestData = 0; -#endif + delete m_listModelData; m_listModelData = 0; -- cgit v1.2.3 From 16914894f035963ace51c92de13aad11a53c3cf8 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Mon, 12 Sep 2016 11:22:01 +0200 Subject: QML: Cleanup prefix/suffixes for plug-in resolving So now we can read it without getting cross-eyed. Change-Id: Ica6a072fcd505fd4fedca3ccfac7dfc00b522354 Reviewed-by: Lars Knoll --- src/qml/qml/qqmlimport.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'src/qml/qml') diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp index ee4d3efa6f..98e2f9eefd 100644 --- a/src/qml/qml/qqmlimport.cpp +++ b/src/qml/qml/qqmlimport.cpp @@ -1727,29 +1727,32 @@ QString QQmlImportDatabase::resolvePlugin(QQmlTypeLoader *typeLoader, const QString &baseName) { #if defined(Q_OS_WIN) - return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName, - QStringList() + static const QString prefix; + static const QStringList suffixes = { # ifdef QT_DEBUG - << QLatin1String("d.dll") // try a qmake-style debug build first + QLatin1String("d.dll"), // try a qmake-style debug build first # endif - << QLatin1String(".dll")); + QLatin1String(".dll") + }; #elif defined(Q_OS_DARWIN) - - return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName, - QStringList() + static const QString prefix = QLatin1String("lib"); + static const QStringList suffixes = { # ifdef QT_DEBUG - << QLatin1String("_debug.dylib") // try a qmake-style debug build first - << QLatin1String(".dylib") + QLatin1String("_debug.dylib"), // try a qmake-style debug build first + QLatin1String(".dylib"), # else - << QLatin1String(".dylib") - << QLatin1String("_debug.dylib") // try a qmake-style debug build after + QLatin1String(".dylib"), + QLatin1String("_debug.dylib"), // try a qmake-style debug build after # endif - << QLatin1String(".so") - << QLatin1String(".bundle"), - QLatin1String("lib")); + QLatin1String(".so"), + QLatin1String(".bundle") + }; # else // Unix - return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName, QStringList() << QLatin1String(".so"), QLatin1String("lib")); + static const QString prefix = QLatin1String("lib"); + static const QStringList suffixes = { QLatin1String(".so") }; #endif + + return resolvePlugin(typeLoader, qmldirPath, qmldirPluginPath, baseName, suffixes, prefix); } /*! -- cgit v1.2.3