summaryrefslogtreecommitdiffstats
path: root/src/declarative/qml
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-23 01:52:06 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-23 01:52:06 (GMT)
commit92e7f06b3690e6e39af8fac7af6c101b416b0f4c (patch)
treee8ad882eb106b083cfe70b015f8aeaef15f04ca3 /src/declarative/qml
parentaf3c75a63e9b7dd9725443a8e23114f825c6d12b (diff)
downloadQt-92e7f06b3690e6e39af8fac7af6c101b416b0f4c.zip
Qt-92e7f06b3690e6e39af8fac7af6c101b416b0f4c.tar.gz
Qt-92e7f06b3690e6e39af8fac7af6c101b416b0f4c.tar.bz2
Don't crash if Connections::target is changed by one of its signal handlers
Reviewed-by: Michael Brasser
Diffstat (limited to 'src/declarative/qml')
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal.cpp6
-rw-r--r--src/declarative/qml/qdeclarativeboundsignal_p.h5
2 files changed, 8 insertions, 3 deletions
diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp
index 00a93cc..eb352a2 100644
--- a/src/declarative/qml/qdeclarativeboundsignal.cpp
+++ b/src/declarative/qml/qdeclarativeboundsignal.cpp
@@ -95,7 +95,7 @@ QDeclarativeAbstractBoundSignal::~QDeclarativeAbstractBoundSignal()
QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMethod &signal,
QObject *parent)
-: m_expression(0), m_signal(signal), m_paramsValid(false), m_params(0)
+: m_expression(0), m_signal(signal), m_paramsValid(false), m_isEvaluating(false), m_params(0)
{
// A cached evaluation of the QDeclarativeExpression::value() slot index.
//
@@ -111,7 +111,7 @@ QDeclarativeBoundSignal::QDeclarativeBoundSignal(QObject *scope, const QMetaMeth
QDeclarativeBoundSignal::QDeclarativeBoundSignal(QDeclarativeContext *ctxt, const QString &val,
QObject *scope, const QMetaMethod &signal,
QObject *parent)
-: m_expression(0), m_signal(signal), m_paramsValid(false), m_params(0)
+: m_expression(0), m_signal(signal), m_paramsValid(false), m_isEvaluating(false), m_params(0)
{
// A cached evaluation of the QDeclarativeExpression::value() slot index.
//
@@ -169,6 +169,7 @@ QDeclarativeBoundSignal *QDeclarativeBoundSignal::cast(QObject *o)
int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
{
if (c == QMetaObject::InvokeMetaMethod && id == evaluateIdx) {
+ m_isEvaluating = true;
if (!m_paramsValid) {
if (!m_signal.parameterTypes().isEmpty())
m_params = new QDeclarativeBoundSignalParameters(m_signal, this);
@@ -182,6 +183,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a)
QDeclarativeEnginePrivate::warning(m_expression->engine(), m_expression->error());
}
if (m_params) m_params->clearValues();
+ m_isEvaluating = false;
return -1;
} else {
return QObject::qt_metacall(c, id, a);
diff --git a/src/declarative/qml/qdeclarativeboundsignal_p.h b/src/declarative/qml/qdeclarativeboundsignal_p.h
index bba4eec..06900d7 100644
--- a/src/declarative/qml/qdeclarativeboundsignal_p.h
+++ b/src/declarative/qml/qdeclarativeboundsignal_p.h
@@ -83,6 +83,8 @@ public:
QDeclarativeExpression *expression() const;
QDeclarativeExpression *setExpression(QDeclarativeExpression *);
+ bool isEvaluating() const { return m_isEvaluating; }
+
static QDeclarativeBoundSignal *cast(QObject *);
protected:
@@ -91,7 +93,8 @@ protected:
private:
QDeclarativeExpression *m_expression;
QMetaMethod m_signal;
- bool m_paramsValid;
+ bool m_paramsValid : 1;
+ bool m_isEvaluating : 1;
QDeclarativeBoundSignalParameters *m_params;
};