aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4qobjectwrapper_p.h
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2016-11-28 14:16:27 +0100
committerLars Knoll <lars.knoll@qt.io>2016-11-29 20:00:35 +0000
commit17c7cb2b0dc7f14603932e059013aa8bb39eef27 (patch)
treecf98328990642861e9a44dbececff4435f10162b /src/qml/jsruntime/qv4qobjectwrapper_p.h
parent46941afcc10209905a92e6bb8b3eba7c08bf6750 (diff)
Avoid a duplicated wasDeleted() check
Change-Id: I30258041ca19cb7d925e4817c8f36577c335282d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/jsruntime/qv4qobjectwrapper_p.h')
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper_p.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/qml/jsruntime/qv4qobjectwrapper_p.h b/src/qml/jsruntime/qv4qobjectwrapper_p.h
index 504f6a69b8..c7c4f4dd77 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper_p.h
+++ b/src/qml/jsruntime/qv4qobjectwrapper_p.h
@@ -206,14 +206,15 @@ private:
inline ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
{
- if (Q_LIKELY(!QQmlData::wasDeleted(object))) {
- QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
- if (Q_LIKELY(priv->declarativeData)) {
- auto ddata = static_cast<QQmlData *>(priv->declarativeData);
- if (Q_LIKELY(ddata->jsEngineId == engine->m_engineId && !ddata->jsWrapper.isUndefined())) {
- // We own the JS object
- return ddata->jsWrapper.value();
- }
+ if (Q_UNLIKELY(QQmlData::wasDeleted(object)))
+ return QV4::Encode::null();
+
+ QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
+ if (Q_LIKELY(priv->declarativeData)) {
+ auto ddata = static_cast<QQmlData *>(priv->declarativeData);
+ if (Q_LIKELY(ddata->jsEngineId == engine->m_engineId && !ddata->jsWrapper.isUndefined())) {
+ // We own the JS object
+ return ddata->jsWrapper.value();
}
}