aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2020-06-24 10:42:19 +0200
committerUlf Hermann <ulf.hermann@qt.io>2020-06-24 17:45:40 +0200
commitee6deafdb1848759d9233c37241eab4a50f2cdbf (patch)
tree82a18032d916ea86b38d87dfb84178785fbc5153 /src
parent56de8b41f24fda23eaba34dd6e034cf409966b17 (diff)
Replace QQmlBoundSignalExpressionPointer with QQmlRefPointer
They do the same thing. Change-Id: Ia35832e6175728e7480d09caba6d3833718d9e80 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/imports/statemachine/signaltransition.cpp1
-rw-r--r--src/imports/statemachine/signaltransition.h5
-rw-r--r--src/qml/.prev_CMakeLists.txt3
-rw-r--r--src/qml/CMakeLists.txt3
-rw-r--r--src/qml/qml/qml.pri1
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp54
-rw-r--r--src/qml/qml/qqmlboundsignal_p.h5
-rw-r--r--src/qml/qml/qqmlboundsignalexpressionpointer_p.h81
-rw-r--r--src/qml/qml/qqmlproperty_p.h2
-rw-r--r--src/quick/util/qquickpropertychanges.cpp19
10 files changed, 24 insertions, 150 deletions
diff --git a/src/imports/statemachine/signaltransition.cpp b/src/imports/statemachine/signaltransition.cpp
index c70a824fb6..693969e8b5 100644
--- a/src/imports/statemachine/signaltransition.cpp
+++ b/src/imports/statemachine/signaltransition.cpp
@@ -50,7 +50,6 @@
#include <private/qjsvalue_p.h>
#include <private/qv4scopedvalue_p.h>
#include <private/qqmlcontext_p.h>
-#include <private/qqmlboundsignal_p.h>
SignalTransition::SignalTransition(QState *parent)
: QSignalTransition(this, SIGNAL(invokeYourself()), parent), m_complete(false), m_signalExpression(nullptr)
diff --git a/src/imports/statemachine/signaltransition.h b/src/imports/statemachine/signaltransition.h
index 4d73368eb0..7cef80bb4c 100644
--- a/src/imports/statemachine/signaltransition.h
+++ b/src/imports/statemachine/signaltransition.h
@@ -47,7 +47,8 @@
#include <QtQml/qqmlscriptstring.h>
#include <QtQml/qqmlparserstatus.h>
#include <private/qqmlcustomparser_p.h>
-#include <private/qqmlboundsignalexpressionpointer_p.h>
+#include <private/qqmlrefcount_p.h>
+#include <private/qqmlboundsignal_p.h>
QT_BEGIN_NAMESPACE
@@ -93,7 +94,7 @@ private:
bool m_complete;
QQmlRefPointer<QV4::ExecutableCompilationUnit> m_compilationUnit;
QList<const QV4::CompiledData::Binding *> m_bindings;
- QQmlBoundSignalExpressionPointer m_signalExpression;
+ QQmlRefPointer<QQmlBoundSignalExpression> m_signalExpression;
};
class SignalTransitionParser : public QQmlCustomParser
diff --git a/src/qml/.prev_CMakeLists.txt b/src/qml/.prev_CMakeLists.txt
index 49d707034d..c950c4304c 100644
--- a/src/qml/.prev_CMakeLists.txt
+++ b/src/qml/.prev_CMakeLists.txt
@@ -189,7 +189,6 @@ qt_add_module(Qml
qml/qqmlapplicationengine.cpp qml/qqmlapplicationengine.h qml/qqmlapplicationengine_p.h
qml/qqmlbinding.cpp qml/qqmlbinding_p.h
qml/qqmlboundsignal.cpp qml/qqmlboundsignal_p.h
- qml/qqmlboundsignalexpressionpointer_p.h
qml/qqmlcleanup.cpp qml/qqmlcleanup_p.h
qml/qqmlcomponent.cpp qml/qqmlcomponent.h qml/qqmlcomponent_p.h
qml/qqmlcomponentattached_p.h
@@ -576,7 +575,7 @@ qt_extend_target(Qml CONDITION DEFINES___contains___WTF_USE_UDIS86=1
# QMAKE_EXTRA_COMPILERS = "udis86"
# QMAKE_EXTRA_TARGETS = "udis86_tab_cfile"
# udis86.CONFIG = "no_link"
-# udis86.commands = "$QMAKE_PYTHON" "$$PWD/disassembler/udis86/itab.py" "${QMAKE_FILE_IN}"
+# udis86.commands = "$$QMAKE_PYTHON" "$$PWD/disassembler/udis86/itab.py" "${QMAKE_FILE_IN}"
# udis86.input = "ITAB"
# udis86.output = "udis86_itab.h"
# udis86_tab_cfile.depends = "udis86_itab.h"
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt
index 0195d9f571..14312ee5a3 100644
--- a/src/qml/CMakeLists.txt
+++ b/src/qml/CMakeLists.txt
@@ -189,7 +189,6 @@ qt_add_module(Qml
qml/qqmlapplicationengine.cpp qml/qqmlapplicationengine.h qml/qqmlapplicationengine_p.h
qml/qqmlbinding.cpp qml/qqmlbinding_p.h
qml/qqmlboundsignal.cpp qml/qqmlboundsignal_p.h
- qml/qqmlboundsignalexpressionpointer_p.h
qml/qqmlcleanup.cpp qml/qqmlcleanup_p.h
qml/qqmlcomponent.cpp qml/qqmlcomponent.h qml/qqmlcomponent_p.h
qml/qqmlcomponentattached_p.h
@@ -583,7 +582,7 @@ qt_extend_target(Qml CONDITION DEFINES___contains___WTF_USE_UDIS86=1
# QMAKE_EXTRA_COMPILERS = "udis86"
# QMAKE_EXTRA_TARGETS = "udis86_tab_cfile"
# udis86.CONFIG = "no_link"
-# udis86.commands = "$QMAKE_PYTHON" "$$PWD/disassembler/udis86/itab.py" "${QMAKE_FILE_IN}"
+# udis86.commands = "$$QMAKE_PYTHON" "$$PWD/disassembler/udis86/itab.py" "${QMAKE_FILE_IN}"
# udis86.input = "ITAB"
# udis86.output = "udis86_itab.h"
# udis86_tab_cfile.depends = "udis86_itab.h"
diff --git a/src/qml/qml/qml.pri b/src/qml/qml/qml.pri
index f345e50648..3601f78d28 100644
--- a/src/qml/qml/qml.pri
+++ b/src/qml/qml/qml.pri
@@ -93,7 +93,6 @@ HEADERS += \
$$PWD/qqmlpropertyvaluesource.h \
$$PWD/qqmlpropertyvalueinterceptor_p.h \
$$PWD/qqmlboundsignal_p.h \
- $$PWD/qqmlboundsignalexpressionpointer_p.h \
$$PWD/qqmlparserstatus.h \
$$PWD/qqmlproxymetaobject_p.h \
$$PWD/qqmlvme_p.h \
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index e87f691203..a818f0e944 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -299,13 +299,12 @@ void QQmlBoundSignal::removeFromObject()
}
}
-
/*!
Returns the signal expression.
*/
QQmlBoundSignalExpression *QQmlBoundSignal::expression() const
{
- return m_expression;
+ return m_expression.data();
}
/*!
@@ -315,7 +314,7 @@ QQmlBoundSignalExpression *QQmlBoundSignal::expression() const
*/
void QQmlBoundSignal::takeExpression(QQmlBoundSignalExpression *e)
{
- m_expression.take(e);
+ m_expression.adopt(e);
if (m_expression)
m_expression->setNotifyOnValueChanged(false);
}
@@ -354,7 +353,8 @@ void QQmlBoundSignal_callback(QQmlNotifierEndpoint *e, void **a)
s->m_expression->function() ? s->m_expression->function()->name()->toQString() : QString(),
s->m_expression->sourceLocation().sourceFile, s->m_expression->sourceLocation().line,
s->m_expression->sourceLocation().column);
- QQmlHandlingSignalProfiler prof(QQmlEnginePrivate::get(engine)->profiler, s->m_expression);
+ QQmlHandlingSignalProfiler prof(QQmlEnginePrivate::get(engine)->profiler,
+ s->m_expression.data());
s->m_expression->evaluate(a);
if (s->m_expression && s->m_expression->hasError()) {
QQmlEnginePrivate::warning(engine, s->m_expression->error(engine));
@@ -364,57 +364,13 @@ void QQmlBoundSignal_callback(QQmlNotifierEndpoint *e, void **a)
////////////////////////////////////////////////////////////////////////
-QQmlBoundSignalExpressionPointer::QQmlBoundSignalExpressionPointer(QQmlBoundSignalExpression *o)
-: o(o)
-{
- if (o) o->addref();
-}
-
-QQmlBoundSignalExpressionPointer::QQmlBoundSignalExpressionPointer(const QQmlBoundSignalExpressionPointer &other)
-: o(other.o)
-{
- if (o) o->addref();
-}
-
-QQmlBoundSignalExpressionPointer::~QQmlBoundSignalExpressionPointer()
-{
- if (o) o->release();
-}
-
-QQmlBoundSignalExpressionPointer &QQmlBoundSignalExpressionPointer::operator=(const QQmlBoundSignalExpressionPointer &other)
-{
- if (other.o) other.o->addref();
- if (o) o->release();
- o = other.o;
- return *this;
-}
-
-QQmlBoundSignalExpressionPointer &QQmlBoundSignalExpressionPointer::operator=(QQmlBoundSignalExpression *other)
-{
- if (other) other->addref();
- if (o) o->release();
- o = other;
- return *this;
-}
-
-/*!
-Takes ownership of \a other. take() does *not* add a reference, as it assumes ownership
-of the callers reference of other.
-*/
-QQmlBoundSignalExpressionPointer &QQmlBoundSignalExpressionPointer::take(QQmlBoundSignalExpression *other)
-{
- if (o) o->release();
- o = other;
- return *this;
-}
-
QQmlPropertyObserver::QQmlPropertyObserver(QQmlBoundSignalExpression *expr)
: QPropertyObserver([](QPropertyObserver *self, void *) {
auto This = static_cast<QQmlPropertyObserver*>(self);
This->expression->evaluate(QList<QVariant>());
})
{
- expression.take(expr);
+ expression.adopt(expr);
}
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlboundsignal_p.h b/src/qml/qml/qqmlboundsignal_p.h
index 71a3e90b7f..d034d874df 100644
--- a/src/qml/qml/qqmlboundsignal_p.h
+++ b/src/qml/qml/qqmlboundsignal_p.h
@@ -54,7 +54,6 @@
#include <QtCore/qmetaobject.h>
#include <private/qqmljavascriptexpression_p.h>
-#include <private/qqmlboundsignalexpressionpointer_p.h>
#include <private/qqmlnotifier_p.h>
#include <private/qflagpointer_p.h>
#include <private/qqmlrefcount_p.h>
@@ -123,7 +122,7 @@ private:
bool m_enabled;
- QQmlBoundSignalExpressionPointer m_expression;
+ QQmlRefPointer<QQmlBoundSignalExpression> m_expression;
};
class QQmlPropertyObserver : public QPropertyObserver
@@ -132,7 +131,7 @@ public:
QQmlPropertyObserver(QQmlBoundSignalExpression *expr);
private:
- QQmlBoundSignalExpressionPointer expression;
+ QQmlRefPointer<QQmlBoundSignalExpression> expression;
};
QT_END_NAMESPACE
diff --git a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h b/src/qml/qml/qqmlboundsignalexpressionpointer_p.h
deleted file mode 100644
index eabe6666b4..0000000000
--- a/src/qml/qml/qqmlboundsignalexpressionpointer_p.h
+++ /dev/null
@@ -1,81 +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 QQMLBOUNDSIGNALEXPRESSIONPOINTER_P_H
-#define QQMLBOUNDSIGNALEXPRESSIONPOINTER_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 <QtQml/qtqmlglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QQmlBoundSignalExpression;
-class Q_QML_PRIVATE_EXPORT QQmlBoundSignalExpressionPointer
-{
-public:
- inline QQmlBoundSignalExpressionPointer() {}
- QQmlBoundSignalExpressionPointer(QQmlBoundSignalExpression *);
- QQmlBoundSignalExpressionPointer(const QQmlBoundSignalExpressionPointer &);
- ~QQmlBoundSignalExpressionPointer();
-
- QQmlBoundSignalExpressionPointer &operator=(const QQmlBoundSignalExpressionPointer &o);
- QQmlBoundSignalExpressionPointer &operator=(QQmlBoundSignalExpression *);
-
- inline QQmlBoundSignalExpression* operator->() const { return o; }
- inline QQmlBoundSignalExpression& operator*() const { return *o; }
- inline operator QQmlBoundSignalExpression*() const { return o; }
-
- QQmlBoundSignalExpressionPointer &take(QQmlBoundSignalExpression *);
-
-private:
- QQmlBoundSignalExpression *o = nullptr;
-};
-
-QT_END_NAMESPACE
-
-#endif // QQMLBOUNDSIGNALEXPRESSIONPOINTER_P_H
diff --git a/src/qml/qml/qqmlproperty_p.h b/src/qml/qml/qqmlproperty_p.h
index f8315854f7..75b505ddc9 100644
--- a/src/qml/qml/qqmlproperty_p.h
+++ b/src/qml/qml/qqmlproperty_p.h
@@ -58,7 +58,6 @@
#include <private/qtqmlglobal_p.h>
#include <private/qqmlrefcount_p.h>
#include <private/qqmlcontextdata_p.h>
-#include <private/qqmlboundsignalexpressionpointer_p.h>
#include <private/qqmlpropertydata_p.h>
#include <private/qqmlpropertyindex_p.h>
@@ -69,6 +68,7 @@ class QQmlEnginePrivate;
class QQmlJavaScriptExpression;
class QQmlMetaObject;
class QQmlAbstractBinding;
+class QQmlBoundSignalExpression;
class Q_QML_PRIVATE_EXPORT QQmlPropertyPrivate : public QQmlRefCount
{
diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp
index 74e8d056c5..e0cc66ed35 100644
--- a/src/quick/util/qquickpropertychanges.cpp
+++ b/src/quick/util/qquickpropertychanges.cpp
@@ -146,17 +146,17 @@ public:
EventType type() const override { return SignalHandler; }
QQmlProperty property;
- QQmlBoundSignalExpressionPointer expression;
- QQmlBoundSignalExpressionPointer reverseExpression;
- QQmlBoundSignalExpressionPointer rewindExpression;
+ QQmlRefPointer<QQmlBoundSignalExpression> expression;
+ QQmlRefPointer<QQmlBoundSignalExpression> reverseExpression;
+ QQmlRefPointer<QQmlBoundSignalExpression> rewindExpression;
void execute() override {
- QQmlPropertyPrivate::setSignalExpression(property, expression);
+ QQmlPropertyPrivate::setSignalExpression(property, expression.data());
}
bool isReversable() override { return true; }
void reverse() override {
- QQmlPropertyPrivate::setSignalExpression(property, reverseExpression);
+ QQmlPropertyPrivate::setSignalExpression(property, reverseExpression.data());
}
void saveOriginals() override {
@@ -175,7 +175,7 @@ public:
}
void rewind() override {
- QQmlPropertyPrivate::setSignalExpression(property, rewindExpression);
+ QQmlPropertyPrivate::setSignalExpression(property, rewindExpression.data());
}
void saveCurrentValues() override {
rewindExpression = QQmlPropertyPrivate::signalExpression(property);
@@ -292,8 +292,11 @@ void QQuickPropertyChangesPrivate::decodeBinding(const QString &propertyPrefix,
if (prop.isSignalProperty()) {
QQuickReplaceSignalHandler *handler = new QQuickReplaceSignalHandler;
handler->property = prop;
- handler->expression.take(new QQmlBoundSignalExpression(object, QQmlPropertyPrivate::get(prop)->signalIndex(),
- QQmlContextData::get(qmlContext(q)), object, compilationUnit->runtimeFunctions.at(binding->value.compiledScriptIndex)));
+ handler->expression.adopt(
+ new QQmlBoundSignalExpression(
+ object, QQmlPropertyPrivate::get(prop)->signalIndex(),
+ QQmlContextData::get(qmlContext(q)), object,
+ compilationUnit->runtimeFunctions.at(binding->value.compiledScriptIndex)));
signalReplacements << handler;
return;
}