diff options
author | Thomas Hartmann <Thomas.Hartmann@nokia.com> | 2010-09-15 08:55:50 (GMT) |
---|---|---|
committer | Thomas Hartmann <Thomas.Hartmann@nokia.com> | 2010-09-15 08:55:50 (GMT) |
commit | 4303f95b24af971393ba5d42eae616f683abaa04 (patch) | |
tree | e80c20352d7976c1bcd112cb935167bf3bd17dd3 /src | |
parent | dc4a56df2809566b5d6a95126f9b834ea34be3fa (diff) | |
download | Qt-4303f95b24af971393ba5d42eae616f683abaa04.zip Qt-4303f95b24af971393ba5d42eae616f683abaa04.tar.gz Qt-4303f95b24af971393ba5d42eae616f683abaa04.tar.bz2 |
crashfix for tst_qdeclarativeanimations::badTypes()
We always have to check for 0 before converting
a raw pointer into a smart pointer
Reviewed-by: Kai Koehne
Diffstat (limited to 'src')
-rw-r--r-- | src/declarative/qml/qdeclarativebinding_p.h | 3 | ||||
-rw-r--r-- | src/declarative/util/qdeclarativestate_p_p.h | 10 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/declarative/qml/qdeclarativebinding_p.h b/src/declarative/qml/qdeclarativebinding_p.h index f38ed23..941a1b3 100644 --- a/src/declarative/qml/qdeclarativebinding_p.h +++ b/src/declarative/qml/qdeclarativebinding_p.h @@ -88,13 +88,14 @@ public: void addToObject(QObject *); void removeFromObject(); - Pointer weakPointer(); + static Pointer getPointer(QDeclarativeAbstractBinding *p) { return p ? p->weakPointer() : Pointer(); } protected: virtual ~QDeclarativeAbstractBinding(); void clear(); private: + Pointer weakPointer(); friend class QDeclarativeData; friend class QDeclarativeValueTypeProxyBinding; diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h index c3c7bb4..4fd8f21 100644 --- a/src/declarative/util/qdeclarativestate_p_p.h +++ b/src/declarative/util/qdeclarativestate_p_p.h @@ -80,12 +80,12 @@ public: if (state == StartState) { m_value = a.fromValue; if (QDeclarativePropertyPrivate::binding(m_property)) { - m_binding = QDeclarativePropertyPrivate::binding(m_property)->weakPointer(); + m_binding = QDeclarativeAbstractBinding::getPointer(QDeclarativePropertyPrivate::binding(m_property)); } m_reverseEvent = true; } else { m_value = a.toValue; - m_binding = a.toBinding->weakPointer(); + m_binding = QDeclarativeAbstractBinding::getPointer(a.toBinding); m_reverseEvent = false; } } @@ -97,7 +97,7 @@ public: QDeclarativeSimpleAction(const QDeclarativeSimpleAction &other) : m_property(other.m_property), m_value(other.m_value), - m_binding(other.binding() ? other.binding()->weakPointer() : QDeclarativeAbstractBinding::Pointer()), + m_binding(QDeclarativeAbstractBinding::getPointer(other.binding())), m_specifiedObject(other.m_specifiedObject), m_specifiedProperty(other.m_specifiedProperty), m_event(other.m_event), @@ -109,7 +109,7 @@ public: { m_property = other.m_property; m_value = other.m_value; - m_binding = other.binding() ? other.binding()->weakPointer() : QDeclarativeAbstractBinding::Pointer(); + m_binding = QDeclarativeAbstractBinding::getPointer(other.binding()); m_specifiedObject = other.m_specifiedObject; m_specifiedProperty = other.m_specifiedProperty; m_event = other.m_event; @@ -140,7 +140,7 @@ public: void setBinding(QDeclarativeAbstractBinding *binding) { - m_binding = binding->weakPointer(); + m_binding = QDeclarativeAbstractBinding::getPointer(binding); } QDeclarativeAbstractBinding *binding() const |