aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2017-07-28 21:32:56 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-07-28 21:33:17 +0200
commit182983943b76bc0e40ff7693853ef2262323fa80 (patch)
tree4e542c3f2906e348da045375c3a3a85fc1d0d73c /src/qml/qml
parent8ced0f0f9954f857265fd18080da95427069135d (diff)
parent80e03bbd9a42401d50af450aff5351c3a0c95444 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Diffstat (limited to 'src/qml/qml')
-rw-r--r--src/qml/qml/qqmlbinding.cpp7
-rw-r--r--src/qml/qml/qqmlextensioninterface.h3
-rw-r--r--src/qml/qml/qqmlimport.cpp4
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp4
-rw-r--r--src/qml/qml/qqmljavascriptexpression_p.h2
-rw-r--r--src/qml/qml/qqmlnotifier.cpp9
-rw-r--r--src/qml/qml/qqmlnotifier_p.h10
7 files changed, 26 insertions, 13 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp
index 0ccb4e8e4e..84f30af066 100644
--- a/src/qml/qml/qqmlbinding.cpp
+++ b/src/qml/qml/qqmlbinding.cpp
@@ -559,7 +559,12 @@ void QQmlBinding::getPropertyData(QQmlPropertyData **propertyData, QQmlPropertyD
Q_ASSERT(propertyData);
QQmlData *data = QQmlData::get(*m_target, false);
- Q_ASSERT(data && data->propertyCache);
+ Q_ASSERT(data);
+
+ if (Q_UNLIKELY(!data->propertyCache)) {
+ data->propertyCache = QQmlEnginePrivate::get(context()->engine)->cache(m_target->metaObject());
+ data->propertyCache->addref();
+ }
*propertyData = data->propertyCache->property(m_targetIndex.coreIndex());
Q_ASSERT(*propertyData);
diff --git a/src/qml/qml/qqmlextensioninterface.h b/src/qml/qml/qqmlextensioninterface.h
index ef56d5e312..62b9b26569 100644
--- a/src/qml/qml/qqmlextensioninterface.h
+++ b/src/qml/qml/qqmlextensioninterface.h
@@ -66,7 +66,10 @@ public:
Q_DECLARE_INTERFACE(QQmlTypesExtensionInterface, "org.qt-project.Qt.QQmlTypesExtensionInterface/1.0")
+// NOTE: When changing this to a new version and deciding to add backup code to
+// continue to support the previous version, make sure to support both of these iids.
#define QQmlExtensionInterface_iid "org.qt-project.Qt.QQmlExtensionInterface/1.0"
+#define QQmlExtensionInterface_iid_old "org.qt-project.Qt.QQmlExtensionInterface"
Q_DECLARE_INTERFACE(QQmlExtensionInterface, QQmlExtensionInterface_iid)
diff --git a/src/qml/qml/qqmlimport.cpp b/src/qml/qml/qqmlimport.cpp
index d2a7970a84..fc8e60e3f2 100644
--- a/src/qml/qml/qqmlimport.cpp
+++ b/src/qml/qml/qqmlimport.cpp
@@ -971,8 +971,8 @@ static QVector<QStaticPlugin> makePlugins()
// the list the first time called to only contain QML plugins:
const auto staticPlugins = QPluginLoader::staticPlugins();
for (const QStaticPlugin &plugin : staticPlugins) {
- if (plugin.metaData().value(QLatin1String("IID")).toString()
- == QLatin1String(QQmlExtensionInterface_iid)) {
+ const QString iid = plugin.metaData().value(QLatin1String("IID")).toString();
+ if (iid == QLatin1String(QQmlExtensionInterface_iid) || iid == QLatin1String(QQmlExtensionInterface_iid_old)) {
plugins.append(plugin);
}
}
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index 214cfff6b2..31c277d283 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -283,7 +283,7 @@ void QQmlPropertyCapture::captureProperty(QQmlNotifier *n, Duration duration)
\a n is in the signal index range (see QObjectPrivate::signalIndex()).
*/
-void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration duration)
+void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration duration, bool doNotify)
{
if (watcher->wasDeleted())
return;
@@ -319,7 +319,7 @@ void QQmlPropertyCapture::captureProperty(QObject *o, int c, int n, Duration dur
Q_ASSERT(g->isConnected(o, n));
} else {
g = QQmlJavaScriptExpressionGuard::New(expression, engine);
- g->connect(o, n, engine);
+ g->connect(o, n, engine, doNotify);
}
if (duration == Permanently)
diff --git a/src/qml/qml/qqmljavascriptexpression_p.h b/src/qml/qml/qqmljavascriptexpression_p.h
index b540959331..8b4b64f4d2 100644
--- a/src/qml/qml/qqmljavascriptexpression_p.h
+++ b/src/qml/qml/qqmljavascriptexpression_p.h
@@ -206,7 +206,7 @@ public:
static void registerQmlDependencies(const QV4::CompiledData::Function *compiledFunction, const QV4::Scope &scope);
void captureProperty(QQmlNotifier *, Duration duration = OnlyOnce);
- void captureProperty(QObject *, int, int, Duration duration = OnlyOnce);
+ void captureProperty(QObject *, int, int, Duration duration = OnlyOnce, bool doNotify = true);
QQmlEngine *engine;
QQmlJavaScriptExpression *expression;
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index 538ca822ee..938e2b77e2 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -117,7 +117,7 @@ void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a)
\a sourceSignal MUST be in the signal index range (see QObjectPrivate::signalIndex()).
This is different from QMetaMethod::methodIndex().
*/
-void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine *engine)
+void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine *engine, bool doNotify)
{
disconnect();
@@ -142,8 +142,11 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine
QQmlPropertyPrivate::flushSignal(source, sourceSignal);
QQmlData *ddata = QQmlData::get(source, true);
ddata->addNotify(sourceSignal, this);
- QObjectPrivate * const priv = QObjectPrivate::get(source);
- priv->connectNotify(QMetaObjectPrivate::signal(source->metaObject(), sourceSignal));
+ if (doNotify) {
+ needsConnectNotify = doNotify;
+ QObjectPrivate * const priv = QObjectPrivate::get(source);
+ priv->connectNotify(QMetaObjectPrivate::signal(source->metaObject(), sourceSignal));
+ }
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h
index dad79e0e55..6e91369793 100644
--- a/src/qml/qml/qqmlnotifier_p.h
+++ b/src/qml/qml/qqmlnotifier_p.h
@@ -100,7 +100,7 @@ public:
inline bool isConnected(QObject *source, int sourceSignal) const;
inline bool isConnected(QQmlNotifier *) const;
- void connect(QObject *source, int sourceSignal, QQmlEngine *engine);
+ void connect(QObject *source, int sourceSignal, QQmlEngine *engine, bool doNotify = true);
inline void connect(QQmlNotifier *);
inline void disconnect();
@@ -121,9 +121,10 @@ private:
inline QQmlNotifier *senderAsNotifier() const;
Callback callback:4;
+ int needsConnectNotify:1;
// The index is in the range returned by QObjectPrivate::signalIndex().
// This is different from QMetaMethod::methodIndex().
- signed int sourceSignal:28;
+ signed int sourceSignal:27;
};
QQmlNotifier::QQmlNotifier()
@@ -155,7 +156,7 @@ void QQmlNotifier::notify()
}
QQmlNotifierEndpoint::QQmlNotifierEndpoint(Callback callback)
-: next(0), prev(0), senderPtr(0), callback(callback), sourceSignal(-1)
+: next(0), prev(0), senderPtr(0), callback(callback), needsConnectNotify(false), sourceSignal(-1)
{
}
@@ -205,7 +206,8 @@ void QQmlNotifierEndpoint::disconnect()
if (sourceSignal != -1) {
QObject * const obj = senderAsObject();
QObjectPrivate * const priv = QObjectPrivate::get(obj);
- priv->disconnectNotify(QMetaObjectPrivate::signal(obj->metaObject(), sourceSignal));
+ if (needsConnectNotify)
+ priv->disconnectNotify(QMetaObjectPrivate::signal(obj->metaObject(), sourceSignal));
}
if (isNotifying()) *((qintptr *)(senderPtr & ~0x1)) = 0;